Docs
Text Input
The Text Input widget sends a line of text to a virtual pin.
Use it for: a message on a display, a WiFi name, a device label, a command string your sketch parses.
| Setting | What it does |
|---|---|
| Pin | the virtual pin your code reads |
| Max length | how many characters the field accepts |
| Placeholder | the hint shown when the field is empty |
Open these from the canvas: tap Edit, then long press the widget and choose Configure.
Example
Text typed on V17 goes to an LCD.
#include <PlynxSimpleEsp32.h>
WidgetLCD lcd(V18);
PLYNX_WRITE(V17)
{
lcd.clear();
lcd.print(0, 0, param.asStr());
}
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();
}
void loop()
{
Plynx.run();
} param.asStr() gives you a const char*. Copy it if you need to keep it: the
buffer is reused as soon as the handler returns.
char message[33];
PLYNX_WRITE(V17)
{
strncpy(message, param.asStr(), sizeof(message) - 1);
message[sizeof(message) - 1] = '\0';
} Troubleshooting
| Problem | Check |
|---|---|
| Text arrives empty | the widget pin and PLYNX_WRITE() do not match |
| Text turns into garbage later | the pointer was stored instead of the characters; copy it |
| Long text gets cut | Max length in the widget settings, and your own buffer size |