用pico做了个简单的交通灯程序,结果倒计时的循环运行不到100个循环就死机。原来还以为是板子问题或者数码管问题,后来发现不接数码管也能遇到该问题,只要运行数码管循环程序。查了半天终于找到解决方法,如下链接,需要修改tm1637.py驱动代码中的sleep函数,根据帖子的反馈,同样的代码ESP32没问题,只发生在pico上。
- you need to replace all the "sleep_us" occurrencies with "time.sleep"
- change the "TM1637_DELAY = const(10)" line with "TM1637_DELAY = const(0.00001)"
- replace the "from time import sleep_us, sleep_ms" line to "import time"
- I also changed the "sleep_ms(delay)" inside the scroll function with "time.sleep(delay)" and changed the original "delay=250" with "delay=0.250"
Pico freezes/hangs when using a 7 Segmen LED screen - Raspberry Pi Forums
TM1637.py来自GitHub - mcauser/micropython-tm1637: MicroPython driver for TM1637 quad 7-segment LED modules
吐槽一下,CSDN现在和百度文库一样堕落了,很多文章都要付费才能看,只能去Bing上面搜索国外的帖子了。