Docs
LCD
The LCD widget shows two lines of text, 16 characters each. Your board prints to it by position.
Use it for: a status line, two readings side by side, a short message, the kind of output a real 16x2 display would show.
| Setting | What it does |
|---|---|
| Pin | the virtual pin your code writes to |
| Mode | Simple prints what you send, Advanced accepts position commands |
| Colour | the text and backlight colour |
Open these from the canvas: tap Edit, then long press the widget and choose Configure.
Example
Temperature on the top line, humidity below.
#include <PlynxSimpleEsp32.h>
WidgetLCD lcd(V21);
PlynxTimer timer;
void updateDisplay()
{
float celsius = analogRead(34) * (3.3 / 4095.0) * 100.0;
float percent = analogRead(35) * 100.0 / 4095.0;
lcd.clear();
lcd.print(0, 0, "Temp: ");
lcd.print(6, 0, celsius);
lcd.print(0, 1, "Hum: ");
lcd.print(6, 1, percent);
}
void setup()
{
Serial.begin(115200);
// 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();
timer.setInterval(5000L, updateDisplay);
}
void loop()
{
Plynx.run();
timer.run();
} lcd.print(x, y, text) puts text at column x, row y. Columns run 0 to
15, rows are 0 and 1.
lcd.clear() wipes both lines. Without it, a shorter string leaves the tail of
the previous one on screen.
Five seconds is a sensible interval. Each call sends a message, so refreshing
in loop() floods the connection.
Troubleshooting
| Problem | Check |
|---|---|
| Display stays empty | the widget pin and the WidgetLCD pin do not match |
| Old text stays behind new text | call clear() before printing |
| Text is cut off | 16 characters per line is the limit |
| Board drops offline | printing too often; use a timer with a few seconds |