// Define the pins for the RGB LED
const int redPin = 11;
const int greenPin = 10;
const int bluePin = 9;
// Define the delay between colour changes
const int delayTime = 1000;
void setup() {
// Set the RGB LED pins as outputs
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}
void loop() {
// Set the RGB LED to red
digitalWrite(redPin, HIGH);
digitalWrite(greenPin, LOW);
digitalWrite(bluePin, LOW);
// Wait for a short period of time
delay(delayTime);
//Yellow
digitalWrite(redPin, HIGH);
digitalWrite(greenPin, HIGH);
digitalWrite(bluePin, LOW);
//Wait
delay(delayTime);
// Set the RGB LED to green
digitalWrite(redPin, LOW);
digitalWrite(greenPin, HIGH);
digitalWrite(bluePin, LOW);
// Wait for a short period of time
delay(delayTime);
//Aqua
digitalWrite(redPin, LOW);
digitalWrite(greenPin, HIGH);
digitalWrite(bluePin, HIGH);
//Wait
delay(delayTime);
// Set the RGB LED to blue
digitalWrite(redPin, LOW);
digitalWrite(greenPin, LOW);
digitalWrite(bluePin, HIGH);
// Wait for a short period of time
delay(delayTime);
//Purple
digitalWrite(redPin, HIGH);
digitalWrite(greenPin, LOW);
digitalWrite(bluePin, HIGH);
//Wait
delay(delayTime);
}