New answers tagged


You can use an interrupt handler to measure frequency. Works quite well. volatile int32_t _ticks = 0; public void FrequencyIsr() { _ticks++; } // Add this to setup() // Mode can be FALLING, RISING or CHANGE attachInterrupt(digitalPinToInterrupt(pin), FrequencyIsr, mode); // Add this to loop() int32_t currentTime = millis(); // Clear the interrupt flag, ...

Top 50 recent answers are included