import machine
import ssd1306
import time
from ir_rx import NEC
i2c = machine.I2C(0, sda=machine.Pin(0), scl=machine.Pin(1))
oled = ssd1306.SSD1306_I2C(128, 64, i2c, addr=0x3C)
def test_control(data, addr, ctrl):
if data >= 0:
oled.fill(0)
oled.text("DETECTADO!", 20, 10)
oled.text("CODIGO: " + str(data), 20, 40)
oled.show()
print("Boton presionado, codigo:", data)
receptor = NEC(machine.Pin(15, machine.Pin.IN), test_control)
oled.fill(0)
oled.text("DALE AL BOTON", 15, 30)
oled.show()
while True:
time.sleep(1)