Quantcast
Viewing all articles
Browse latest Browse all 5139

MicroPython • Re: Hardware .irq Interrupt on Button Push Difficulty

Try this basic aproach to debounce:

Code:

    if (time.ticks_ms()-delta) > debounce:
This will act oddly when ticks_ms() rolls over. Better to use time.ticks_diff() which corrects for this.

(Rollover happens at 2³⁰ ms, which admittedly isn't very often)

Statistics: Posted by scruss — Thu Dec 12, 2024 5:11 pm



Viewing all articles
Browse latest Browse all 5139

Trending Articles