Is the delay() after the serial.flush() needed to keep the SimpleDyno side from buffer overflow? You're sending 89 characters per sample @ 20 samples/sec = 1780 characters/sec , theoretical speed at 115200baud = 14,440 char/sec Just realized that's how you're setting the samples/sec. PDR's method is better and non-blocking.
If you're doing 4 interrupts per revolution, at say 12000 rpm, that's 800 interrupts per second. The delay(20) stops interrupt service routines, so your timing subroutine is getting blocked.
Also it's somewhat inefficient to build a string to send to serial. Just serial.print() each line followed by a serial.println()
Last edited by GerryH; 04-20-2024 at 07:09 AM.