/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: dan
  • Date: 2016-04-10 13:50:17 UTC
  • Revision ID: dan-20160410135017-2tpazgewnjazokqo
Removed -cash.lib from the ignore file

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
// This program tries to measure the frequency of the signal pulses in
8
8
// microseconds.  It takes several measurements and prints out the average over
9
9
// serial.
10
 
//
 
10
 
11
11
 
12
12
// number of signal pulses to average
13
13
#define SIGNAL_SAMPLES 10
50
50
                {
51
51
                        // check interval
52
52
                        unsigned long interval = new_pulse - last_pulse;
53
 
                        if( interval < 300 )
 
53
                        if( false && interval < 300 )
54
54
                        {
55
55
                                Serial.print( "[" );
56
56
                                Serial.print( last_pulse );
75
75
                if( interval_idx == 0 && got_pulse )
76
76
                {
77
77
                        // 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
 
                        }
 
78
                        long interval = 0;
 
79
                        for( int a = 0; a < SIGNAL_SAMPLES; a++ )
 
80
                                interval += intervals[ a ];
 
81
                        
 
82
                        Serial.print( intervals[ 0 ] );
 
83
                        Serial.println();
85
84
                }               
86
85
        }
87
86
}