from machine import Pin
from time import sleep_ms
#from botoes import Button
class Button(object):
UP=1
DOWN=0
def __init__(self, pin, pull=None, pressed=1):
if pull is None:
self._pin = Pin(pin, Pin.IN)
else:
#self._pin = Pin(pin, Pin.IN, Pin.PULL_UP if pull=Button.UP else Pin.PULL_DOWN)
self._pin = Pin(pin, Pin.IN, Pin.PULL_UP if pull==Button.UP else Pin.PULL_DOWN)
self._als = self._pls = self._pin()
def event(self, type=None):
self._alg = self._pin() # alg: actual logic state
#bot = Button(pin=25, pull=None, pressed=1, action=pressed|released)
bot = Button(pin=25, pull=Button.DOWN, pressed=1)
while True:
sleep_ms(2000)
print ("1")
#if bot.pressed():
# print ("Pressionado")