This blog is a record of what I do, what I think and what I read. If you are interested to know about my professional experience, you can refer to the other blog of mine. http://admi2camac.blogspot.com/
Friday, 3 February 2023
TRL - Exercise2c
#Using def function
#Library
from gpiozero import LED
from time import sleep
#Setup Components / Variables
tf_red_led = LED(13)
tf_amber_led = LED(19)
tf_green_led = LED(26)
#Alorgithm
#Initialize the LEDs
tf_red_led.off()
tf_amber_led.off()
tf_green_led.off()
def trafficLight():
tf_green_led.on()
sleep(10)
tf_green_led.off()
tf_amber_led.on()
sleep(5)
tf_amber_led.off()
tf_red_led.on()
sleep(10)
tf_red_led.off()
while True:
trafficLight()
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment