Skip to main content

Terminal Widget

📊 Chart

The Terminal widget displays a scrolling log of text values sent to a virtual pin — like a serial monitor in the cloud. Lines are timestamped and color-coded optionally. You can also type commands and send them to the device (bidirectional mode).

Default size: 3 × 3 grid cells

Preview

Terminal Widget Preview

Widget appearance may vary slightly from the actual dashboard.


Configuration

PropertyTypeDefaultDescription
maxLinesnumber100Maximum lines kept in view
showTimestampbooleantruePrepend each line with time
DevicedeviceThe device to read/write
PinV0V255The virtual pin for I/O
LabelstringWidget label

Sending logs to the terminal

// Any string pushed to the pin appears as a new line
void loop() {
Vwire.run();

if (sensorError) {
Vwire.virtualSend(V10, "ERROR: sensor read failed");
}

float v = readVoltage();
char buf[64];
snprintf(buf, sizeof(buf), "Voltage: %.2f V", v);
Vwire.virtualSend(V10, buf);

delay(5000);
}

Bidirectional: receive commands from terminal

VWIRE_RECEIVE(V10) {
String cmd = param.asStr();

if (cmd == "reset") {
ESP.restart();
} else if (cmd.startsWith("setpin ")) {
int pin = cmd.substring(7).toInt();
digitalWrite(pin, HIGH);
Vwire.virtualSend(V10, "OK");
} else {
Vwire.virtualSend(V10, "Unknown command: " + cmd);
}
}

Log levels by convention

Since VWire sends raw strings, you can prefix lines to implement logging levels:

#define LOG_INFO(msg)  Vwire.virtualSend(V10, "[INFO]  " msg)
#define LOG_WARN(msg) Vwire.virtualSend(V10, "[WARN] " msg)
#define LOG_ERROR(msg) Vwire.virtualSend(V10, "[ERROR] " msg)

// Usage
LOG_INFO("Boot complete");
LOG_WARN("Low battery: 12%");
LOG_ERROR("Sensor timeout");