KY-034 7 Color flash-LED
If this module is powered, a sequence of color changes is automatically emitted from the LED.
- Arduino
- Raspberry Pi
- Raspberry Pi Pico
- Micro:Bit
This module contains a 7-color flash LED that automatically emits a sequence of color changes as soon as it is supplied with voltage. The LED has 7 different colors and can produce all resulting mixed colors. This module is ideal for decorative lighting projects, visual displays and effects where changing colors are desired. The automatic color sequence means you don't need any additional control, making it easy to integrate into different projects. It is perfect for creative applications where dynamic and appealing lighting is required.
Technical Data | |
---|---|
Voltage range | 3.3 V - 5 V |
Pin assignment
Arduino | Sensor |
---|---|
Pin 13 | Signal |
GND | GND |
Code example
This code example shows how an LED can be switched on for four seconds and then switched off for two seconds by means of a definable output spin.
To load the following code example onto your Arduino, we recommend using the Arduino IDE. In the IDE, you can select the appropriate port and board for your device.
Copy the code below into your IDE. To upload the code to your Arduino, simply click on the upload button.
int led = 13; // Declaration of the LED input pin
void setup() {
pinMode(led, OUTPUT); // Initialization output pin for the LED
}
void loop() {
digitalWrite(led, HIGH); // LED is switched on
delay(4000); // Wait for 4 seconds
digitalWrite(led, LOW); // LED is switched off
delay(2000); // Wait for another two seconds
}
This module contains a 7-color flash LED that automatically emits a sequence of color changes as soon as it is supplied with voltage. The LED has 7 different colors and can produce all resulting mixed colors. This module is ideal for decorative lighting projects, visual displays and effects where changing colors are desired. The automatic color sequence means you don't need any additional control, making it easy to integrate into different projects. It is perfect for creative applications where dynamic and appealing lighting is required.
Technical Data | |
---|---|
Voltage range | 3.3 V - 5 V |
Pin assignment
Raspberry Pi | Sensor |
---|---|
GPIO 24 [Pin 18] | Signal |
GND [Pin 6] | GND |
Code example
from gpiozero import LED
import time
# Initialization of the LED
led = LED(24)
print("LED test [press CTRL+C to end the test]")
# Main program loop
try:
while True:
print("LED on for 4 seconds")
led.on() # LED is switched on
time.sleep(4) # Wait mode for 4 seconds
print("LED off for 2 seconds")
led.off() # LED is switched off
time.sleep(2) # Waiting mode for a further two seconds, during which the LED is then switched off
# Clean up after the program has been completed
except KeyboardInterrupt:
print("Program was interrupted by user")
# gpiozero automatically takes care of the cleanup when the program is interrupted
This module contains a 7-color flash LED that automatically emits a sequence of color changes as soon as it is supplied with voltage. The LED has 7 different colors and can produce all resulting mixed colors. This module is ideal for decorative lighting projects, visual displays and effects where changing colors are desired. The automatic color sequence means you don't need any additional control, making it easy to integrate into different projects. It is perfect for creative applications where dynamic and appealing lighting is required.
Technical Data | |
---|---|
Voltage range | 3.3 V - 5 V |
Pin assignment
Micro:Bit | Sensor |
---|---|
Pin 1 | Signal |
GND | GND |
Code example
input.onButtonPressed(Button.A, function () {
pins.digitalWritePin(DigitalPin.P1, 1)
})
input.onButtonPressed(Button.B, function () {
pins.digitalWritePin(DigitalPin.P1, 0)
})
Sample program download
This module contains a 7-color flash LED that automatically emits a sequence of color changes as soon as it is supplied with voltage. The LED has 7 different colors and can produce all resulting mixed colors. This module is ideal for decorative lighting projects, visual displays and effects where changing colors are desired. The automatic color sequence means you don't need any additional control, making it easy to integrate into different projects. It is perfect for creative applications where dynamic and appealing lighting is required.
Technical Data | |
---|---|
Voltage range | 3.3 V - 5 V |
Pin assignment
Raspberry Pi Pico | Sensor |
---|---|
GPIO18 | Signal |
- | - |
GND | GND |
Code example
This code example shows how an LED can be alternately switched on for ten seconds and then switched off for two seconds by means of a definable output pin.
To load the following code example onto your Pico, we recommend using the Thonny IDE. All you have to do first is go to Run > Configure interpreter ... > Interpreter > Which kind of interpreter should Thonny use for running your code? and select MicroPython (Raspberry Pi Pico).
Now copy the code below into your IDE and click on Run.
# Load libraries
from machine import Pin
import time
# Initialization of GPIO18 as output
led = Pin(18, Pin.OUT)
# Endless loop for the ON/OFF switching of the LED
while True:
led.value(0)
time.sleep(2)
led.value(1)
time.sleep(10)