This will act oddly when ticks_ms() rolls over. Better to use time.ticks_diff() which corrects for this.Try this basic aproach to debounce:Code:
if (time.ticks_ms()-delta) > debounce:
(Rollover happens at 2³⁰ ms, which admittedly isn't very often)
Statistics: Posted by scruss — Thu Dec 12, 2024 5:11 pm