from machine import Pin
import time
time.sleep(0.1) # Wait for USB to become ready
print("Hello, Pi Pico!")
s1 = Pin (13, Pin.IN)
s2 = Pin (5, Pin.IN)
s3 = Pin (17, Pin.IN)
r = Pin(28, Pin.OUT)
g = Pin(27, Pin.OUT)
b = Pin(26, Pin.OUT)
buzzer = Pin(6, Pin.OUT)
while True:
# Read the currect state of the slide switch
ss1 = s1.value()
ss2 = s2.value()
ss3 = s3.value()
print ("switch state =", ss1)
if ss1 == 1:
print("red on")
r.value(1)
else:
print("red off")
r.value(0)
if ss2 == 1:
print("green on")
g.value(1)
else:
print("green off")
g.value(0)
if ss3 == 1:
print("blue on")
b.value(1)
else:
print("blue off")
b.value(0)
time.sleep(0.1) # 100 milliseconds