from machine import Pin
from utime import sleep_ms,ticks_ms
led1=Pin(25,Pin.OUT)
led2=Pin(26,Pin.OUT)
led3=Pin(32,Pin.OUT)
led4=Pin(33,Pin.OUT)
button_pin12=Pin(12,Pin.IN,Pin.PULL_UP)
button_pin13=Pin(13,Pin.IN,Pin.PULL_UP)
button_pin14=Pin(14,Pin.IN,Pin.PULL_UP)
button_pin15=Pin(15,Pin.IN,Pin.PULL_UP)
while True:
button_value1=button_pin12.value()
button_value2=button_pin13.value()
button_value3=button_pin14.value()
button_value4=button_pin15.value()
if button_value1==0:
led1.on()
print("First Button Value=",button_value1,ticks_ms)
sleep_ms(600)
elif button_value2==0:
led2.on()
print("Second Button Value=",button_value2,ticks_ms)
sleep_ms(600)
elif button_value3==0:
led3.on()
print("Third Button Value=",button_value3,ticks_ms)
sleep_ms(600)
elif button_value4==0:
led4.on()
print("Fourth Button Value=",button_value4,ticks_ms)
sleep_ms(600)
else:
led1.off()
led2.off()
led3.off()
led4.off()
print("No Buttons Pressed")
sleep_ms(600)