Hi,
I probably have a trivial problem which I can't really understand. I'm trying to run the example code with teensy 3.6 but it seems like the freq isn't available. I would like to measure the F_BUS. The main porpose is to track time in sub-microsecond scale. It prints no pulses all the time (except the second print). I tried different pins (5,6,23) and it is the same. What did I miss?
Thanks in advance
I probably have a trivial problem which I can't really understand. I'm trying to run the example code with teensy 3.6 but it seems like the freq isn't available. I would like to measure the F_BUS. The main porpose is to track time in sub-microsecond scale. It prints no pulses all the time (except the second print). I tried different pins (5,6,23) and it is the same. What did I miss?
Thanks in advance
Code:
/* FreqMeasureMulti - Example with serial output
* http://www.pjrc.com/teensy/td_libs_FreqMeasure.html
*
* This example code is in the public domain.
*/
#include <FreqMeasureMulti.h>
// Measure 3 frequencies at the same time! :-)
FreqMeasureMulti freq1;
void setup() {
Serial.begin(57600);
while (!Serial) ; // wait for Arduino Serial Monitor
delay(10);
Serial.println("FreqMeasureMulti Begin");
delay(10);
freq1.begin(6);
}
float sum1=0;
int count1=0;
elapsedMillis timeout;
void loop() {
if (freq1.available()) {
sum1 = sum1 + freq1.read();
count1 = count1 + 1;
}
// print results every half second
if (timeout > 500) {
if (count1 > 0) {
Serial.print(freq1.countToFrequency(sum1 / count1));
} else {
Serial.print("(no pulses)");
}
Serial.print(", ");
Serial.println();
sum1 = 0;
count1 = 0;
timeout = 0;
}
}
Last edited: