#include "pico/stdlib.h"
// Define the pins
#define RED_PIN 0
#define GREEN_PIN 1
#define BLUE_PIN 2
int main() {
// Initialize the pins
gpio_init(RED_PIN);
gpio_init(GREEN_PIN);
gpio_init(BLUE_PIN);
// Set the pins as outputs
gpio_set_dir(RED_PIN, true);
gpio_set_dir(GREEN_PIN, true);
gpio_set_dir(BLUE_PIN, true);
// Initialize all LEDs off
gpio_put(RED_PIN, false);
gpio_put(GREEN_PIN, false);
gpio_put(BLUE_PIN, false);
// Loop forever
while (true) {
// RED light (2 seconds)
gpio_put(RED_PIN, true);
gpio_put(GREEN_PIN, false);
gpio_put(BLUE_PIN, false);
sleep_ms(2000);
// GREEN light (2 seconds)
gpio_put(RED_PIN, false);
gpio_put(GREEN_PIN, true);
gpio_put(BLUE_PIN, false);
sleep_ms(2000);
// YELLOW light (Red + Green) (1 second)
gpio_put(RED_PIN, true);
gpio_put(GREEN_PIN, true);
gpio_put(BLUE_PIN, false);
sleep_ms(1000);
}
return 0;
}