WeirdMatter
Member
// Teensy 3.6 on Windows 10
I am trying to work with the FreqMeasure library and this tutorial to read the input frequency on the Teensy 3.6. Unfortunately, however, I haven't been able to get any reporting to the serial monitor.
I set my function generator to output a 327 Hz sine wave at 100 mVpp, and connected the ground to the Teensy's GND and the lead to the Teensy pin 3 (which I am to believe is the frequency input pin for the Teensy 3.6). I am using the tutorial's exact code below:
If I place the line
as the first statement inside of the loop() function, it constantly prints "0" out to the serial monitor.
Does anybody have any ideas why it doesn't seem to be finding any readable frequency?
Thank you in advance!
I am trying to work with the FreqMeasure library and this tutorial to read the input frequency on the Teensy 3.6. Unfortunately, however, I haven't been able to get any reporting to the serial monitor.
I set my function generator to output a 327 Hz sine wave at 100 mVpp, and connected the ground to the Teensy's GND and the lead to the Teensy pin 3 (which I am to believe is the frequency input pin for the Teensy 3.6). I am using the tutorial's exact code below:
Code:
/* FreqMeasure - Example with serial output
* http://www.pjrc.com/teensy/td_libs_FreqMeasure.html
*
* This example code is in the public domain.
*/
#include <FreqMeasure.h>
void setup() {
Serial.begin(57600);
FreqMeasure.begin();
}
double sum=0;
int count=0;
void loop() {
if (FreqMeasure.available()) {
// average several reading together
sum = sum + FreqMeasure.read();
count = count + 1;
if (count > 30) {
float frequency = FreqMeasure.countToFrequency(sum / count);
Serial.println(frequency);
sum = 0;
count = 0;
}
}
}
If I place the line
Code:
Serial.println(FreqMeasure.available())
Does anybody have any ideas why it doesn't seem to be finding any readable frequency?
Thank you in advance!