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

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

$
0
0
Try this basic aproach to debounce:

Code:

    if (time.ticks_ms()-delta) > debounce:[/quote]This will act oddly when ticks_ms() rolls over. Better to use [url=https://docs.micropython.org/en/v1.24.0/library/time.html#time.ticks_diff]time.ticks_diff()[/url] 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 5216

Trending Articles