s00500 / ESPUI

A simple web user interface library for ESP32 and ESP8266

Home Page:https://valencia.lbsfilm.at/midterm-presentation/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example of how to set min and max values for slider

jackthese opened this issue · comments

None of the provided examples show how to set min and max values for a slider control. They all appear to default to min=0 and max=100. I've looked at the library code and its complexity is beyond my comprehension. My starting point from one of the examples is

ESPUI.addControl(ControlType::Slider, "MotorRPM", "30", ControlColor::Alizarin, Control::noParent, &slider);

This line created a slider from 0 to 100 with the value set to 30. What do I need to add or modify to set new min and max values?

The completeExample shows it.

Indeed, and somehow I had missed it. Works perfectly to set a stepper motor RPM for some testing I'm doing. Thanks very much for your quick reply...

uint16_t mainSlider = ESPUI.addControl(ControlType::Slider, "MotorRPM", "100", ControlColor::Alizarin, Control::noParent, &slider);
ESPUI.addControl(Max, "RPM", "320", None, mainSlider);