I want to measure the frequency of a square signal generated by a multimeter.
If i put a 50Hz signal, i expect to measure a period of 20.000micros, but the monitor shows a signal that sometimes is steady around 19.500 and sometimes around 20.500 (not values between these values).
Similar code works in other microcontroller (ARDUINO33IOTSENSE, based in same CPU), but not with this one. Why??
This is the code (sad that we can not post a photo…):
unsigned int tiempoinicial=0;
unsigned int tiempo=0;
int rpmPin = A0;
void isr() //interrupt function
pinMode(rpmPin, INPUT_PULLUP); //also tried “INPUT”
attachInterrupt(digitalPinToInterrupt(rpmPin),isr,RISING); //Create interruption