Code: Select all
def main():
from machine import Pin, I2C
from ssd1306 import SSD1306_I2C
from utime import sleep
i2c=I2C(1,sda=Pin(2), scl=Pin(3), freq=400000)
oled = SSD1306_I2C(128, 64, i2c)
points = [\
(9,11),(10,11),(11,11),
(12,12),\
(13,13),(13,14),(13,15),\
(14,16),\
(15,17),(16,17),(17,17),\
(18,16),\
(19,15),(19,14),(19,13),\
(20,12)]
for snake in range(5):
for p in points:
oled.pixel(snake*(20-9)+p[0],p[1], 1)
oled.show()
sleep(.01)
for snake in range(5):
for p in points:
oled.pixel(snake*(20-9)+p[0],p[1], 0)
oled.show()
sleep(.005)
main()
if I unplug the pico and replug it in Windows shows this message: "USB device not recognized"
Device manager shows a device with the warning yellow triangle. Scanning devices, replugging the pico does not change the status.
Restarting the PC DOES fix it - Windows recognize the Pico again, and I was able to use Thonny to fix main.py so this no longer happen.
Interestingly, my Mac does NOT have this issue. Same Pico, same untouched main.py.
I suspect it has something to do with I2C being too busy to handle USB traffic.
Have you seen this behavior on your Pi Pico?