from machine import Pin, I2C
import ssd1306
# ESP32 Pin assignment
i2c = I2C(0, scl=Pin(22), sda=Pin(21))
oled_width = 128
oled_height = 64
oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c)
arriba = Pin(25, Pin.IN, Pin.PULL_UP)
abajo = Pin(26, Pin.IN, Pin.PULL_UP)
# Agrega la función siguiente() a continuación -------------
# ------------------------------------------------------------
def siguiente(x,y):
x += 1 #
oled.pixel(x,y, 1) #
if arriba.value() == 0: #
y += 1 #
if abajo.value() == 0: #
y -= 1
return (x,y)
x = 0 #
y = 32 #
while True:
x, y = siguiente(x,y)
oled.show()