PL9823 RGB led
Posted: Tue Feb 25, 2025 10:13 pm
Hi all
Has anyone successfully put stm32 to work with PL9823 RGB leds?
I'm using Adafruit neopixel library without success, i can only see my led turning blue and nothing else.
Here's my code, it should blink blue, green, red
Has anyone successfully put stm32 to work with PL9823 RGB leds?
I'm using Adafruit neopixel library without success, i can only see my led turning blue and nothing else.
Here's my code, it should blink blue, green, red
Code: Select all
#include <Adafruit_NeoPixel.h>
#define PIN PA12
#define NUMPIXELS 1
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
//Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_RGB + NEO_KHZ400); // also tried this, didn't work
#define DELAYVAL 1500
void setup() {
Serial.begin(9600);
Serial.println("RGB LED Test");
pixels.begin();
pixels.show();
pixels.setBrightness(128);
}
void loop() {
Serial.println("BLUE");
pixels.clear();
for(int i=0; i<NUMPIXELS; i++) {
pixels.setPixelColor(i, pixels.Color(0, 0, 255));
pixels.show();
delay(DELAYVAL);
}
Serial.println("GREEN");
pixels.clear();
for(int i=0; i<NUMPIXELS; i++) {
pixels.setPixelColor(i, pixels.Color(0, 255, 0));
pixels.show();
delay(DELAYVAL);
}
Serial.println("RED");
pixels.clear();
for(int i=0; i<NUMPIXELS; i++) {
pixels.setPixelColor(i, pixels.Color(255, 0, 0));
pixels.show();
delay(DELAYVAL);
}
}