/elec/quadcopter

To get this branch, use:
bzr branch http://bzr.ed.am/elec/quadcopter

« back to all changes in this revision

Viewing changes to test/receiver/pulse-freq/main.ino

  • Committer: Tim Marston
  • Date: 2013-10-30 22:41:50 UTC
  • Revision ID: tim@ed.am-20131030224150-t6xs1l783m2yg6rd
updated comments in receiver test programs

Show diffs side-by-side

added added

removed removed

8
8
// microseconds.  It takes several measurements and prints out the average over
9
9
// serial.
10
10
//
 
11
// NOTES: This test is not very useful.  Our second experiment was measuring
 
12
// pulse width (../pulse-width).
11
13
 
12
14
// number of signal pulses to average
13
15
#define SIGNAL_SAMPLES 10
50
52
                {
51
53
                        // check interval
52
54
                        unsigned long interval = new_pulse - last_pulse;
53
 
                        if( interval < 300 )
 
55
                        if( false && interval < 300 )
54
56
                        {
55
57
                                Serial.print( "[" );
56
58
                                Serial.print( last_pulse );
75
77
                if( interval_idx == 0 && got_pulse )
76
78
                {
77
79
                        // calculate average
78
 
                        for( int a = 0; a < SIGNAL_SAMPLES; a++ ) {
79
 
                                Serial.print( intervals[ a ] );
80
 
                                if( a == SIGNAL_SAMPLES - 1 )
81
 
                                        Serial.println();
82
 
                                else
83
 
                                        Serial.print( " " );
84
 
                        }
 
80
                        long interval = 0;
 
81
                        for( int a = 0; a < SIGNAL_SAMPLES; a++ )
 
82
                                interval += intervals[ a ];
 
83
                        
 
84
                        Serial.print( intervals[ 0 ] );
 
85
                        Serial.println();
85
86
                }               
86
87
        }
87
88
}