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.

SettingWhat it does
Pinthe virtual pin your code reads
Max lengthhow many characters the field accepts
Placeholderthe 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.

text-input.ino
#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.

Keep the text after the handler ends
char message[33];

PLYNX_WRITE(V17)
{
  strncpy(message, param.asStr(), sizeof(message) - 1);
  message[sizeof(message) - 1] = '\0';
}

Troubleshooting

ProblemCheck
Text arrives emptythe widget pin and PLYNX_WRITE() do not match
Text turns into garbage laterthe pointer was stored instead of the characters; copy it
Long text gets cutMax length in the widget settings, and your own buffer size

Next