MathPi14 / Arduino-Estlcam-Handwheel-Communication

Communication Protocol for original Estlcam Hardware and DIY Arduino-based Handwheels
5 stars 1 forks source link

Use HWInterrupts instead of polling to register changing states of all buttons #1

Open MathPi14 opened 1 year ago

MathPi14 commented 1 year ago

Not all Arduinos come with 5 Interrupt Pins. In oder to make the code less dependent from the used hardware, polling is used to register button change "events". This can lead to a sluggish response.

In a future release, PinChangeInterrupts (see Arduino site) shall be used to solve this problem. These dont work like "normal" Interrupts and always trigger on both the rising and falling edge. Debouncing and faster Read/ Write cycles (e.g. with direct port manipulation) are necessary.