from machine import Pin
import time
ext_led = Pin(15,Pin.OUT)
ext_led1 = Pin(13,Pin.OUT)
ext_led2 = Pin(5,Pin.OUT)
ext_led3 = Pin(1,Pin.OUT)
button = Pin(14,Pin.IN,Pin.PULL_DOWN)
print("pratice 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('button relesed')
ext_led.value(current_state)
ext_led1.value(current_state)
ext_led2.value(current_state)
ext_led3.value(current_state)
last_state=current_state
time.sleep(0.05)