Docs
Vertical Level
The Vertical Level widget shows a value as a column that fills from the bottom. It is the Level Display turned upright.
Use it when the thing you measure is upright too: a tank, a silo, a rain gauge, a battery in a stack of readings.
| Setting | What it does |
|---|---|
| Pin | the virtual pin your code writes to |
| Min, Max | the values for empty and full |
| Colour | the fill colour |
| Show value | print the number over the column |
Open these from the canvas: tap Edit, then long press the widget and choose Configure.
Example
A rainwater tank reported every minute.
#include <PlynxSimpleEsp32.h>
#define LEVEL_PIN 34
#define FULL_READING 3200 // ADC value with the tank full
PlynxTimer timer;
void sendLevel()
{
int raw = analogRead(LEVEL_PIN);
float percent = raw * 100.0 / FULL_READING;
Plynx.virtualWrite(V32, constrain(percent, 0, 100));
}
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();
timer.setInterval(60000L, sendLevel);
}
void loop()
{
Plynx.run();
timer.run();
} Calibrate FULL_READING with the tank actually full, and print the raw value
to the serial monitor while you do it. A number copied from a datasheet rarely
matches the sensor on your bench.
Troubleshooting
| Problem | Check |
|---|---|
| Column never fills | FULL_READING is higher than the sensor ever reads |
| Column is always full | the widget Max is lower than the values you send |
| Readings drift with the weather | ADC reference changes with temperature; average over time |