Docs

Vertical Slider

The Vertical Slider sends a number in a range, the same as the Slider, with an up and down track.

Use it when up means more: a fader, a tank setpoint, a damper, a light level in a column of controls.

SettingWhat it does
Pinthe virtual pin your code reads
Min, Maxthe range sent at the bottom and the top
Stephow much one notch moves the value
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 fan speed control on V12.

vertical-slider.ino
#include <PlynxSimpleEsp32.h>

#define FAN_PIN  27
#define PWM_FREQ 25000                // above hearing range for fans
#define PWM_BITS 8

PLYNX_WRITE(V12)
{
  ledcWrite(FAN_PIN, param.asInt());  // 0 to 255
}

void setup()
{
  Serial.begin(115200);
  ledcAttach(FAN_PIN, PWM_FREQ, PWM_BITS);

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

Set the widget range to 0 to 255 to match 8 bit PWM. A widget range of 0 to 100 sends 100 at the top, which drives the fan at 39 per cent.

Many fans stall below a minimum duty. Clamp the low end in code rather than letting the slider send values the fan cannot use.

Troubleshooting

ProblemCheck
Fan never reaches full speedthe widget range is smaller than the PWM range
Fan buzzesthe PWM frequency is too low; 25 kHz is inaudible
ledcSetup was not declaredArduino ESP32 core 3.x removed it; use ledcAttach()

Next