A Raspberry Pi Pico and KY-034 7 color flashing LED

In this article, we connect an KY-034 7 color flashing LED to a Raspberry Pi Pico, any Rp2040 type board will be suitable. We actually tested this with a Cytron Maker Pi Pico

The KY-034 7 color flashing LED module can emit red and green light. You can adjust the intensity of each color using a Pico PWM pin or simply switch the LED on/off using standard GPIO.

We will use Micropython for these examples but of course you can use the Arduino IDE as well if you have Raspberry Pi Pico support enabled

Working voltage 3V — 5V DC
LED model YB-3120B4PnYG-PM
LED type 5mm round head

The sensor looks like this

Parts Required

You can connect to the module using dupont style jumper wire.

Name   Link
Raspberry Pi Pico
37 in one sensor kit
Connecting cables

 

Schematic/Connection

Pico SENSOR
GPIO0 S
GND

 

Code Examples

Basic example in  thonny

from machine import Pin
import time

# Initialization of GPIO0 as output
led = Pin(0, Pin.OUT)

# switching on/of the LED
while True:
    led.value(0)
    time.sleep(2)
    led.value(1)
    time.sleep(10)

 

REPL Output

N/A

Links

https://github.com/getelectronics/rp2040learning/tree/main/Sensor%20Kit/KY-034_7_Color_Flash

 

 

Related posts

A Raspberry Pi Pico and KY-001 Temperature Sensor

A Raspberry Pi Pico and KY-006 Passive Buzzer

A Raspberry Pi Pico and KY-012 Active Buzzer

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Read More