In this example we take a look at the KY-011 Two color LED module and connect this to a Raspberry Pi.
As you may have guessed this is a common cathode LED with a red anode and a green anode. You can adjust the amount of each color using PWM.
The module does not include resistors so you need to add these
- Color: Green + Red
- Diameter: 3mm
- Case Color: None
- Package Type: Diffusion
- Voltage (V) :2.0-2 .5
- Using a current (MA): 10
- Viewing angle: 150
- Wavelength (NM): 571 +644
- Luminous intensity (MCD) :20-40; 40-80
- Stent type: long-legged
Parts List
Name | link |
Raspberry Pi 4 | Aliexpress product link |
37 sensor kit | AliExpress Product link |
connecting wire | Aliexpress product link |
Layout
We use pins 38 and 40 (GPIO 20 and 21) in this example, you can use other GPIO pins but you will have to change the code example.
You need the current limiting resistors
Code Examples
https://gist.github.com/getelectronics/0d5655e369e3564d41aaef869f693202
https://gist.github.com/getelectronics/e1f8ac26b4f5a7c0adb14aaafdae09ed