"""
#ISM 6106 MIni Lab
Hello, let's try this
"""
import time
time.sleep(0.1) # Wait for USB to become ready
import machine
print("Hello, Pi Pico!")
from Log import *
from Lights import *
from Button import *
from Buzzer import *
from LightStrip import *
#Machine Led will Blink 5 times
#Log.i('Machine Led Blink 5 times')
#led_pin=machine.Pin(25,machine.Pin.OUT)
#for i in range (0,3):
# led_pin.value(1) # turn on Led
# time.sleep(2) #wait 3 seconds
# led_pin.value(0) #turn off Led
# time.sleep(2) #wait 3 seconds
#Led into dimmable Led
#Log.i("Dimmable Led")
#redled = DimLight(5,"Dimmable Red Led")
#BlueButton = Button(10, 'Blue Button')
# Add a loop
# On iff pressed / off if pressed again
#while True:
# if BlueButton.isPressed():
# redled.on()
# print("RedLed is on")
# if BlueButton.isPressed():
# redled.off()
# print("RedLed is off")
# Red Led ON if Blue button is pressed, Light Strip ON if Green button is pressed
Log.i('Led by button')
redled = Light(5, 'Red LED')
blueButton = Button(10, 'Blue Button')
greenButton = Button(11, 'Green Button')
lightStrip = LightStrip(2, 'LightStrip')
buzzer = PassiveBuzzer(21,'Bocina')
while True:
if blueButton.isPressed():
redled.on()
print("RedLed is on")
buzzer.play(220)
#time.sleep(0.5) # sound for 2 seconds
print("Buzzer playing")
elif greenButton.isPressed():
lightStrip.on()
buzzer.play(tones['B4'])
print("Strip is on")
#if not bottom is pressed, Redled and Light Strip OFF
else:
redled.off()
lightStrip.off()
buzzer.stop()