Introduction
There are two kinds of dual-color Common-Cathode LED in this kit. The only difference is the package size of the LED, as shown below:

Components
– 1 * SunFounder Uno board
– 1 * USB data cable
– 1 * Dual-color Common-Cathode LED module
– Several jumper wires
Experimental Principle
Control the LED brightness by the digital port. The color of the LED changes from yellow to red as well as flashes a mixed color.
Experimental Procedures
Step 1: Build the circuit
Dual-color Common-Cathode LED SunFounder Uno
Y ——————————————- D10
– —————————————— GND
R ——————————————- D11
Step 2: Program (Please refer to the example code in LEARN -> Get Tutorial on our website)
Step 3: Compile
Step 4: Upload the sketch to SunFounder Uno
Now, you can see the dual-color LED flashing yellow, red, and mixed colors.

C Code
int redPin = 11; // select the pin for the red LED int greenPin = 10; // select the pin for the blueLED int val = 0;void setup() { pinMode(redPin, OUTPUT); pinMode(greenPin, OUTPUT); Serial.begin(9600); } /******************************************************/ void loop() { for(val=255; val>0; val–) { analogWrite(redPin, val); analogWrite(greenPin, 255-val); Serial.println(val, DEC); delay(15); } for(val=0; val<255; val++) { analogWrite(redPin, val); analogWrite(greenPin, 255-val); Serial.println(val, DEC); delay(15); } } /********************************************************/ |