Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8609

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

$
0
0
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 8609

Trending Articles