Using an LED Diode (Red, Blue, Green) Common Cathode with Seeeduino Xiao

Description: An LED Diode (Red, Blue, Green) with a Common Cathode alternates turning the red, blue, and green light of the LED ON/OFF with a 1 second delay between each change.

LED Diode (Red, Blue, Green) Common Cathode with Seeeduino Xiao

Supplies:

1 – Breadboard 400 Points
1 – Seeeduino Xiao   >> Link <<
1 – LED (Red, Blue, Green with Common Cathode)   >> Link <<
1 – 220 Ohm Resistor

Arduino Code:

#define green 2
#define blue 3
#define red 4

void setup() {

  pinMode(green, OUTPUT);
  pinMode(blue, OUTPUT);
  pinMode(red, OUTPUT);

}

void loop() {

  /// No Color
  digitalWrite(green, LOW);
  digitalWrite(blue, LOW);
  digitalWrite(red, LOW);
  delay(2000);

  /// Red Color
  digitalWrite(green, HIGH);
  digitalWrite(blue, HIGH);
  digitalWrite(red, LOW);
  delay(1000);

  /// Blue Color
  digitalWrite(green, HIGH);
  digitalWrite(blue, HIGH);
  digitalWrite(red, HIGH);
  delay(1000);

  /// Green Color
  digitalWrite(green, LOW);
  digitalWrite(blue, HIGH);
  digitalWrite(red, HIGH);
  delay(1000);

}

Leave a Comment

− 1 = 5