Hi, I would like to reading the signal by using arduino uno and display the output to serial lcd 16x2. my code at this moment is like this
#include <Wire.h>
#include "LiquidCrystal_I2C.h"
LiquidCrystal_I2C lcd(0x27,16,2);
#include <FreqMeasure.h>
void setup() /*----( SETUP: RUNS ONCE )----*/
{
Serial.begin(14400);
lcd.init();
FreqMeasure.begin();
}/*--(end setup )---*/
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) {
double frequency = F_CPU / (sum / count);
lcd.setCursor(0, 1);
unsigned long speeding = (frequency*0.3)/2; // calculate speed
Serial.print("Freq:");
Serial.print(frequency);
Serial.print(" ");
delay(5000);
sum = 0;
count = 0;
}
}
}
the original code is from here, FreqMeasure Library, for Measuring Frequencies in the 0.1 to 1000 Hz range, or RPM Tachometer Applications
i feed the signal from signal generator to the arduino pin 8 and then i connect serial lcd to the pin Tx arduino. The problem is the output keep going around 49-51 and it not change although i change the frequency from the signal generator. can someone help me? thank you
Moderator edit: Code tags.