/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-23 19:58:45 UTC
  • Revision ID: tim@ed.am-20131023195845-6coin3ndwkkc52np
updated ignores

Show diffs side-by-side

added added

removed removed

Lines of Context:
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).
13
11
 
14
12
// number of signal pulses to average
15
13
#define SIGNAL_SAMPLES 10
52
50
                {
53
51
                        // check interval
54
52
                        unsigned long interval = new_pulse - last_pulse;
55
 
                        if( false && interval < 300 )
 
53
                        if( interval < 300 )
56
54
                        {
57
55
                                Serial.print( "[" );
58
56
                                Serial.print( last_pulse );
77
75
                if( interval_idx == 0 && got_pulse )
78
76
                {
79
77
                        // calculate average
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();
 
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
                        }
86
85
                }               
87
86
        }
88
87
}