Rick, I worked on autopilots back at the start of my career. There the lead software architect did some testing to see how fast you needed to digitally scan a key press to accurately determine it was pressed. He found 30Hz was the scan rate. Every product I worked on, required the processor to perform continuous monitoring of the hardware. So the typical architecture had a running background task, and an interrupt timer, that started a foreground task. This would complete within this interrupt rate, or you would cycle slip, and that would never be release as fielded code (part of the software verification task).
So the foreground task would read the pilot input keypress hardware, and a little filter code, so you could determine it was pressed, then released (flags set,and cleared).
That's one of the problems with Arduino, there is an OS, but it's not really published (I've not taken the time to search and see what it is). All those time delay's are part of that OS.
Well, I did a search for "Arduino timer interrupt" and came up with this link:
https://www.arduino.cc/reference/en/...imerinterrupt/
You need to install that via manage libraries (tools menu).
If you click on read documentation for the timerinterrupt that brings up a github page, with sample software. I looked at examples/ISR_Switch. There the author put in debounce code. And the comments are exactly what you're wanting to have a task that is performed faithfully.

LinkBack URL
About LinkBacks
Reply With Quote


Bookmarks