Docs

Terminal

The Terminal widget prints text from your board and sends text back. It works like a serial monitor you can reach from anywhere.

Use it for: debugging a board you cannot plug in, logs, simple commands, reading a sensor on request.

SettingWhat it does
Pinthe virtual pin used for both directions
Input lineshows or hides the text field
Autoscrollfollows new lines as they arrive

Open these from the canvas: tap Edit, then long press the widget and choose Configure.

Example

Print a greeting on connect, then answer commands typed in the app.

terminal.ino
#include <PlynxSimpleEsp32.h>

WidgetTerminal terminal(V9);

// Runs when you type something and press send.
PLYNX_WRITE(V9)
{
  String cmd = param.asStr();

  if (cmd == "temp") {
    terminal.print("Temperature: ");
    terminal.println(analogRead(34) * (3.3 / 4095.0) * 100.0);
  } else if (cmd == "uptime") {
    terminal.print("Up for ");
    terminal.print(millis() / 1000);
    terminal.println(" s");
  } else {
    terminal.println("Try: temp, uptime");
  }

  terminal.flush();
}

PLYNX_CONNECTED()
{
  terminal.println("Board online. Type a command.");
  terminal.flush();
}

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();
}

terminal.flush() sends what you printed. Without it the text waits in the buffer and reaches the app late, or not at all.

print(), println() and write() behave like the ones on Serial, so existing debug code moves over with a search and replace.

Keep the output small

Every line travels over the network. A println() inside loop() floods the connection and can drop the board offline.

Print on events, or from a timer with a sensible interval.

Troubleshooting

ProblemCheck
Nothing appears in the appflush() is missing after the prints
Text arrives late or in burststhe same, flush() at the end of each message
Commands do nothingthe widget pin and PLYNX_WRITE() do not match
Board disconnects while printingtoo much output; print on events, not every loop

Next