Docs
RGB Picker
The RGB Picker sends a colour as three numbers: red, green and blue, each 0
to 255.
Use it for: LED strips, RGB bulbs, status lights, anything where you pick a colour instead of a level.
| Setting | What it does |
|---|---|
| Pin | one pin carrying all three values |
| Split mode | three separate pins, one per channel |
| Style | colour wheel or square palette |
Open these from the canvas: tap Edit, then long press the widget and choose Configure.
Merged or split
Merged mode is the default: one pin carries all three channels, and your sketch
reads them with param[0], param[1] and param[2].
Turn on Split mode in Configure and the widget asks for three pins instead, one per channel. Your sketch then needs three separate handlers:
PLYNX_WRITE(V10) { ledcWrite(RED_PIN, param.asInt()); }
PLYNX_WRITE(V11) { ledcWrite(GREEN_PIN, param.asInt()); }
PLYNX_WRITE(V12) { ledcWrite(BLUE_PIN, param.asInt()); }
Pick merged unless the channels already live on separate pins in your code. Switching mode later means rewriting the handlers.
Example
A colour wheel on V10 driving three PWM channels.
#include <PlynxSimpleEsp32.h>
#define RED_PIN 25
#define GREEN_PIN 26
#define BLUE_PIN 27
#define PWM_FREQ 5000
#define PWM_BITS 8
// Runs when you pick a colour. Merged mode sends three values at once.
PLYNX_WRITE(V10)
{
int r = param[0].asInt();
int g = param[1].asInt();
int b = param[2].asInt();
ledcWrite(RED_PIN, r);
ledcWrite(GREEN_PIN, g);
ledcWrite(BLUE_PIN, b);
}
void setup()
{
Serial.begin(115200);
ledcAttach(RED_PIN, PWM_FREQ, PWM_BITS);
ledcAttach(GREEN_PIN, PWM_FREQ, PWM_BITS);
ledcAttach(BLUE_PIN, PWM_FREQ, PWM_BITS);
// Auto setup: WiFi and the Plynx token are configured from the app.
//
// To provide them directly in the sketch instead, use:
// Plynx.begin(auth, ssid, pass);
Plynx.begin();
}
void loop()
{
Plynx.run();
} param[0], param[1] and param[2] hold the three channels in order. Split
mode replaces them with three separate PLYNX_WRITE() handlers, one per pin,
each reading a plain param.asInt().
ledcAttach() and ledcWrite() are the ESP32 PWM functions in Arduino core
3.x. Older sketches call ledcSetup() and ledcAttachPin(), which were
removed.
Values arrive while you drag
Moving a finger across the wheel sends a stream of colours, not one at the end.
Keep the handler down to three ledcWrite() calls.
For addressable strips such as WS2812, store the colour and push it to the
strip from a timer. Writing hundreds of pixels inside the handler blocks
Plynx.run() and drops the board offline.
Troubleshooting
| Problem | Check |
|---|---|
| Nothing lights up | the widget pin and PLYNX_WRITE() do not match |
| Only red responds | split mode is on but the sketch reads param[0..2]; use one handler per pin |
| Colours look wrong | the wiring order of the channels does not match the code |
| Board drops while dragging | the handler is too slow; store the colour and write from a timer |