from machine import Pin
import time
ext_led1 = Pin(15,Pin.OUT )
#button = Pin(14,Pin.IN,Pin.PULL_DOWN)
ext_led2 = Pin(16,Pin.OUT)
buzzer = Pin(17,Pin.OUT)
button = Pin(14,Pin.IN,Pin.PULL_DOWN)
print("practice 1 ready:Press and hold button")
last_state= 0
while True :
current_state = button.value ()
if current_state==1 and last_state==0:
#if led2_state==1 and led2_state==0:
print("hold the button led on ")
elif current_state==0 and last_state==1:
# elif led2_state==0 and last_state==1:
print("unhold the buttun led off")
ext_led1.value(current_state)
ext_led2.value(current_state)
buzzer.value(current_state)
last_state =current_state
time.sleep(0.05)