Hi all. I've been pottering trying to get to understand use of a Pico. I hope this is on-topic for the group.
It looks as though timer interrupts and the sleep functions don't mix too well. I've programmed an elementary clock using the tm1637 module and using a 1 second timer interrupt to update the display. Noddy stuff, except it runs for a while and then hangs completely.
If I rejig the code to not be interrupt driven, it seems to run OK.
The tm1637 module makes extensive use of time.sleep_us(), and rather sparse comments on the web suggest that this method and the interrupt don't play well together.
Can anyone confirm there's an issue and whether there's any resolution of it?
Also, there seems to be something odd in that for example time.sleep_ms(1000) works, while time.sleep_us(1000000) does wrong things and hangs.
so while
import time count = 0
while(True): print(count) time.sleep_ms(1000) count = 1+count
behaves as expected, the following:
import time count = 0
while(True): print(count) time.sleep_us(1000*1000) count = 1+count
prints just a 0, and then needs power disconnection to recover.
Changing the one line to time.sleep_us(100*1000) runs, but the lines come out in groups of 10 every second
Any thoughts please?