from machine import Pin
from time import sleep
led = Pin(0,Pin.OUT)
led_1 = Pin(1,Pin.OUT)
led_2 = Pin(2,Pin.OUT)
relay = Pin(3,Pin.OUT)
switch_1 = Pin(5,Pin.IN,Pin.PULL_DOWN)
switch_2 = Pin(6,Pin.IN,Pin.PULL_DOWN)
switch_3 = Pin(7,Pin.IN,Pin.PULL_DOWN)
led.value(1)
led_1.value(1)
led_2.value(1)
while True:
print("Inside The Loop")
if switch_1.value() == 1:
led.value(0) #condition for On.
sleep(1)
led.value(1) #condition for LED off
sleep(0)
if switch_2.value() == 1:
led_1.value(0) #condition for On.
sleep(1)
led_1.value(1) #condition for LED off
sleep(0)
if switch_3.value() == 1:
led_2.value(0) #condition for On.
sleep(1)
led_2.value(1) #condition for LED off
sleep(0)
else:
relay.value(0) #condition for on
sleep(1)
relay.value(1) #LED OFF
sleep(0)