import machine
import time
# Define GPIO pins
GPIO_PIN_1 = 1
GPIO_PIN_2 = 2
GPIO_PIN_3 = 3
# Setup GPIO pins as outputs
def setup_gpio():
# Configure GPIO pins 1, 2, and 3 as outputs
machine.Pin(GPIO_PIN_1, machine.Pin.OUT)
machine.Pin(GPIO_PIN_2, machine.Pin.OUT)
machine.Pin(GPIO_PIN_3, machine.Pin.OUT)
# Function to toggle LEDs in a blinking loop
def led_blinking_loop():
while True:
# Turn on GPIO pin 1 (GPIO_PIN_1)
machine.Pin(GPIO_PIN_1, machine.Pin.OUT).on()
time.sleep(1) # Delay for 1 second
# Turn on GPIO pin 2 (GPIO_PIN_2)
machine.Pin(GPIO_PIN_2, machine.Pin.OUT).on()
time.sleep(1) # Delay for 1 second
# Turn on GPIO pin 3 (GPIO_PIN_3)
machine.Pin(GPIO_PIN_3, machine.Pin.OUT).on()
time.sleep(1) # Delay for 1 second
# Turn off GPIO pin 1 (GPIO_PIN_1)
machine.Pin(GPIO_PIN_1, machine.Pin.OUT).off()
time.sleep(1) # Delay for 1 second
# Turn off GPIO pin 2 (GPIO_PIN_2)
machine.Pin(GPIO_PIN_2, machine.Pin.OUT).off()
time.sleep(1) # Delay for 1 second
# Turn off GPIO pin 3 (GPIO_PIN_3)
machine.Pin(GPIO_PIN_3, machine.Pin.OUT).off()
time.sleep(1) # Delay for 1 second
# Main function to run the program
def main():
setup_gpio() # Initialize GPIO pins
led_blinking_loop() # Start the LED blinking loop
# Execute the main function
if __name__ == "__main__":
main()