Docs

Step

The Step widget has a plus and a minus button. Each press changes the value by a fixed amount and sends the result.

Use it when the exact number matters: a thermostat setpoint, a servo angle, a timer length. Dragging a slider to 21.5 is hard, pressing plus twice is not.

SettingWhat it does
Pinthe virtual pin your code reads
Min, Maxthe limits the value stops at
Stephow much one press adds or subtracts
Loopwrap around from max back to min
Send on releasesend once when you lift your finger

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

Example

A thermostat setpoint on V13, stepping half a degree at a time.

step.ino
#include <PlynxSimpleEsp32.h>

#define HEATER_PIN 25

float setpoint = 20.0;

PLYNX_WRITE(V13)
{
  setpoint = param.asFloat();
}

void setup()
{
  Serial.begin(115200);
  pinMode(HEATER_PIN, OUTPUT);

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

  float room = analogRead(34) * (3.3 / 4095.0) * 100.0;
  digitalWrite(HEATER_PIN, room < setpoint ? HIGH : LOW);
}

Use param.asFloat() when the step is fractional. asInt() truncates 20.5 to 20 and the half degrees disappear.

The widget sends the resulting value, not the amount of the step. Pressing plus on 20.0 with a step of 0.5 sends 20.5.

Restore the setpoint after a reboot

The board comes back with whatever setpoint starts as in your code, while the widget still shows the old number. Ask for it on connect:

Restore V13 after reconnect
PLYNX_CONNECTED()
{
  Plynx.syncVirtual(V13);
}

Troubleshooting

ProblemCheck
Value jumps by the wrong amountStep in the widget settings, not the sketch
Decimals disappearuse param.asFloat() instead of asInt()
Value stops before the limit you wantMin and Max in the widget settings

Next