Example FreqMeasure/Serial_Output tutorial trouble on Teensy 3.6

Status
Not open for further replies.
// 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:

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())
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!
 
the input voltage range for digital pins is 0 to 3.3 V

100mV pp vill not trigger as high level, also make sure to keep voltage above 0V, and below 3.3V
 
Thank you very much! This seemed to have been my issue. I increased my input signal's amplitude to 1 Vpp and set it on a 1 V DC offset to raise it off of the floor and after I reloaded the Teensy, it began reading my frequency for at least a while.

For some reason, the Teensy took quite a few seconds to begin reading my frequency and then did so for a few dozens reports before suddenly reporting my 120 Hz input signal as 260 Hz and stopping. I'm not quite sure why this happened.
 
Status
Not open for further replies.
Back
Top