richas
December 25, 2024, 4:55pm
1
Upload- debug-serial out work but no joy getting the RGB to work. I added the Neopixel library.
I would appreciate any ideas.
Code:
#include <Adafruit_NeoPixel.h>
#define PIN 48
#define NUMPIXELS 1
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
#define DELAYVAL 1000
void setup () {
pixels.begin();
//pixels.setBrightness(0.3);
}
void loop () {
pixels.clear();
for(int i=0; i<NUMPIXELS; i++) {
pixels.setPixelColor(i, pixels.Color(0, 150, 0));
pixels.show();
delay(DELAYVAL);
}
}
Use the builtin function neopixelWrite
.
No need for an external library to drive a single RGB led.
platformio.ini
:
[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
main.cpp
:
#include <Arduino.h>
void setup() {
}
void loop() {
neopixelWrite(RGB_BUILTIN, 255, 0, 0 );
delay(1000);
neopixelWrite(RGB_BUILTIN, 0, 255, 0);
delay(1000);
neopixelWrite(RGB_BUILTIN, 0, 0, 255);
delay(1000);
}
On some DevKits you have to close a solder-bridge.
richas
December 25, 2024, 5:57pm
3
Thanks for the help. You are right, I am able to build your code without the library. Unfortunately no blinkage. It worked when I first powered up the board (default code)
Some boards using a different GPIO for the RGB LED.
Check the datasheet of your board. Do you have a link?
richas
December 25, 2024, 6:19pm
5
That was it. It’s on pin 38 not 48.
Thanks
Rich