techoverload/micro/button.py

20 lines
348 B
Python
Raw Normal View History

2022-07-17 02:32:14 +00:00
from machine import Pin, UART
from time import sleep_ms
import os
def button_irq(pin):
print("pressed")
#button = Pin(5, Pin.IN, Pin.PULL_UP)
#button.irq(trigger=Pin.IRQ_FALLING, handler=button_irq)
os.dupterm(None, 1)
uart = UART(0, baudrate=9600)
while True:
if uart.any():
u = uart.read()
uart.write(u)