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

MicroPython • Re: Code getting stuck after count

$
0
0
That seems inefficient and still prone to drift. Why not use a couple of timers?

Code:

import machinetimer20 = machine.Timer()timer60 = machine.Timer()def do20(t):    print('do 20 second thing')def do60(t):    print('do 60 second thing')    timer20.init(mode=machine.Timer.PERIODIC, period=20000, callback=do20)timer60.init(mode=machine.Timer.PERIODIC, period=60000, callback=do60)

Statistics: Posted by thagrol — Sat Aug 03, 2024 3:20 pm



Viewing all articles
Browse latest Browse all 4829

Trending Articles