"""
from machine import Pin
from time import sleep
led_13 = Pin(13,Pin.OUT)
led_12 = Pin(12,Pin.OUT)
led_14 = Pin(14,Pin.OUT)
while True:
led_12.value(1)
led_13.value(0)
led_14.value(0)
sleep(0.5)
led_12.value(0)
led_13.value(1)
led_14.value(0)
sleep(0.5)
led_12.value(0)
led_13.value(0)
led_14.value(1)
sleep(0.5)
"""
from machine import Pin
from utime import sleep_ms
button = Pin(0,Pin.IN,Pin.PULL_UP) #Internal pull-up
button = Pin(1,Pin.IN,Pin.PULL_UP) #Internal pull-up
button = Pin(2,Pin.IN,Pin.PULL_UP) #Internal pull-up
led = Pin(0, Pin.OUT)
led = Pin(1, Pin.OUT)
led = Pin(2, Pin.OUT)
state=0 #0 means that the light is currently off
if __name__=='__main__':
while True:
print(button.value())
if button.value()==0:
if state==0:
led.value(1)
sleep_ms=100
while button.value()==0:
State=1
else:
led.value(0)
sleep_ms=100
while button.value()==0:
State=0