In this experiment, we make the pin 11, 12, and 13 of the Raspberry Pi output PWM
(pulse-width modulation) signals by programming, to make the RGB LED flash different
colors.
Experimental Procedures
Step 1: Build the circuit
For C language users:
Step 2: Edit and save the code with vim or nano.
(code path: /home/Adeept_Sensor_Kit_for_RPi_C_Code/03_rgbLed/rgbLed.c)
Step 3: Compile
$ sudo gcc rgbLed.c -o rgbLed -lwiringPi -lpthread
2
1
3
4
RGB
220Ω
R1
1
2
3
4
P1
Header
220Ω
R2
220Ω
R3
+
R
G
B