import machine as gpio
import utime as TM
# Define the RGB LED pins (common cathode)
red_pin = gpio.Pin(15, gpio.Pin.OUT) # Pin 15 for Red
green_pin = gpio.Pin(14, gpio.Pin.OUT) # Pin 14 for Green
blue_pin = gpio.Pin(13, gpio.Pin.OUT) # Pin 13 for Blue
# Helper function to set the red color
def set_red_color(state):
red_pin.value(state) # Turn on/off the red pin
green_pin.value(0) # Ensure green is off
blue_pin.value(0) # Ensure blue is off
# Main loop to toggle the red color
while True:
set_red_color(1) # Turn on red
TM.sleep(1) # Wait for 1 second
set_red_color(0) # Turn off red
TM.sleep(1) # Wait for 1 second