HI Guys,
I'm trying to determine the frequency of a square wave (in the range 1Hz to about 2kHz) using an Arduino Due.
I have been searching for a few days now and still not managed to get anywhere really. I'm not a software or hardware guy at all really (fluid mechanical guy here) so all help is appreciated!
I have managed to get the rising edge of the wave to trigger an interupt, but I'm at a loss what to do now...
What i would like to do is be able to do is determine the frequency of the square wave and write it out to the serial monitor for now. This is all i have that works...
const byte ledPin = 13;
const byte interruptPin = 10;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(interruptPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin), RiseEdge, RISING);
Serial.begin(9600); //open serial port at 9600 Baud
}
void loop() {
//Not sure what to do here
}
void RiseEdge() {
// Or here....
}