from machine import Pin
import time
ext_led = Pin(15,Pin.OUT)
button = Pin(14,Pin.IN,Pin.PULL_DOWN)
print("practice 1 ready : press and hold the button")
last_State = 0
while True:
current_State = button.value()
if current_State == 1 and last_state == 0:
print("Button PRESSED")
elif current_State == 0 and last_state == 1:
print("BUTRTON RELEASED")
ext_led.value(current_state)
last_state = current_state
time.sleep(0.01)