First steps into micropython and rpi pico. Need help with error OSError: [Errno 110] ETIMEDOUT #13241
-
Hi all. Here is a copy of the program I copy and pasted from the author TODO : Implement alien shots, Shields, Soundfrom machine import Pin, I2C, ADC, PWM WIDTH = 128 # oled display width #up = Pin(2, Pin.IN, Pin.PULL_DOWN) # for future games #removed for conversion to buttons #Pot = ADC(26) speaker = PWM(Pin(18)) i2c = I2C(0) # Init I2C using I2C0 defaults, SCL=Pin(GP9), SDA=Pin(GP8), freq=400000 oled = SSD1306_I2C(WIDTH, HEIGHT, i2c) # Init oled display lowres = True if lowres == True: ship = bytearray(b" p\xf8l>//>l\xf8p ") num0 = bytearray(b"\x7f\x80\xff\xc0\x80@\x80@\xff\xc0\x7f\x80") aliens = []
def create_alien(type, x, y): def define_aliens(): def reset_aliens(visibility): # Used to reset aliens to starting position and, optionally, visibility
Load images into framebufferinv1aBuff = framebuf.FrameBuffer(inv1a, 7, 7, framebuf.MONO_HLSB) ufoBuff = framebuf.FrameBuffer(ufo, 12, 8, framebuf.MONO_HLSB) logoBuff = framebuf.FrameBuffer(logo, 128, 64, framebuf.MONO_HLSB) #Dictionary for lookup of digits for score, level, possibly lives shipBuff = framebuf.FrameBuffer(ship, 8, 12, framebuf.MONO_HLSB) Clear the oled display in case it has junk on it.oled.fill(0) Finally update the oled display so the image & text is displayedoled.show() sleep(2) addy = 3 #pixels of movement per turn on aliens shotx = 1
` Any help greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It sounds like you are having I2C problems. Maybe you haven't got pull-up resistors on your I2C SCL and SDA lines?
This will print the I2C bus addresses of each I2C peripheral found. |
Beta Was this translation helpful? Give feedback.
It sounds like you are having I2C problems. Maybe you haven't got pull-up resistors on your I2C SCL and SDA lines?
Try this to see if you have communications:
This will print the I2C bus addresses of each I2C peripheral found.
You should see at least one number printed out (and it should be the address of your display).
Per the datasheet:
There should also be external pull-ups on the board as the internal pad pull-ups may not be strong enough to pull up external circuits.