import time # Import Time Package
from machine import Pin # Import the Pin Function from the machine package
# Define the LED pins - EX. (GPIO PIN NUMBER, TYPE)
led_red = machine.Pin(11, Pin.OUT) # Red Pin is connected to GPIO 11 and declared as an output
#led_yellow = machine.Pin(?, Pin.OUT) # Yellow and green LED are commented out -
# Remove the # from the start of the line to stop it being seen as a comment
#led_green = machine.Pin(?, Pin.OUT) # Then find the gpio pin which each LED are connected to from the circuit on the Simulation window
# and replace the question mark within the brackets with the associated pin
## Never Ending Loop - Therefore the code will repeat forever
while True:
led_red.value(1) # Sets the Value of the pin to 1 - Meaning voltage is supplied to the Pin - LED Status: On
time.sleep(0.5) # Time.Sleep(Delay Time) - The board remains in its previous state for 0.5 seconds
led_red.value(0) # Sets the Value of the pin to 0 - Meaning no voltage is supplied to the Pin - LED Status: Off
time.sleep(0.5) # Another delay of 0.5 seconds
## Add Task Code here #########################################################
###############################################################################
## NEXT STEPS
# Task 1 - Add more code to get the yellow LED to also blink after the red one
# - Find the GPIO Pin its connected to in the diagram ->
# - Intialise the pin in line 7 using its pin number
# Task 2 - Add more code to get the green LED to also blink
# - Repeat the steps above for the green LED
# Task 3 - Modify the new code from task 2 to make all 3 LED's turn on, one after the other
# - Then have them all turn off and start again
# Task 4 - Add another blue LED to the circuit and add it to the task 3 sequence
# - Click the blue plus ('+') in the Simulation window and add an LED
# - Click one of the resistors and Ctrl + C & Ctrl + V to copy and paste
# - Add both components to the right side of the breadboard - copying the other LEDs in the circuit
# - Add a wire from a gpio pin to the breadboard
# - Then add a wire from the negative terminal to a pin thats says GND (Ground Pin)
# - Look at the other LEDs already set up for hints