Box IO

Self-hosted IoT for Arduino and ESP32.

Vertical slider

An up-and-down slider. Same min, max, and send rules as the horizontal slider. The sample range includes a negative minimum.

Sample pin: V9

Set it up on the server

  1. Sign in to the Box IO dashboard and open the project that uses this device key.
  2. Turn on Edit.
  3. In Edit, add Vertical slider.
  4. Set Virtual pin to 9.
  5. Set Min to -10 and Max to 10. Type the minus sign, then press Enter. The field applies when you leave it, not on every key.
  6. Save the layout and drag the slider in Live.
  7. Flash the sketch below with the same device key, host, and port 5923. Keep BoxIO.run() in loop().

Properties

Sketch values are always strings, including numbers: BoxIO.setProperty(V2, "max", "200").

PropertyWhere to set itFormatExampleEffect
minDashboard or sketchNumber, negatives allowed5Left or bottom end of the track. Press Enter or leave the field to apply it on the dashboard.
maxDashboard or sketchNumber, negatives allowed50Right or top end of the track. If max is less than min, the track swaps them. If they are equal, max becomes min + 1.
colorDashboard or sketch#RRGGBB#7aa2ffFill and thumb color.
labelDashboard or sketchPlain textPumpCaption above the widget. On a round or oval button this is the caption, not the word on the button face.
hideLabelDashboardOn or offcheckedHides the caption. Button face text, meter numbers, and label text stay visible.
fontSizeDashboardWhole number 8 to 160, or blank for automatic size28Text size in pixels inside the widget.
opacityDashboard10% to 100%70%Lets an overlapping widget show through. 100% is solid.

Formatting

Sketch

Paste the device key over bx_paste_your_device_key_here. Wi-Fi boards include BoxIOEsp32.h. Ethernet boards use the same calls with an EthernetClient.

#define BOXIO_AUTH "bx_paste_your_device_key_here"
#define WIFI_SSID  "your-ssid"
#define WIFI_PASS  "your-password"
#define BOXIO_HOST "localhost"
#define BOXIO_PORT 5923

#include <BoxIOEsp32.h>

void setup() {
  BoxIO.begin(BOXIO_AUTH, WIFI_SSID, WIFI_PASS, BOXIO_HOST, BOXIO_PORT);
BoxIO.setProperty(V9, "label", "V Slider");
  BoxIO.setProperty(V9, "min", "-10");
  BoxIO.setProperty(V9, "max", "10");
  BoxIO.setProperty(V9, "color", "#f5b942");
}

void loop() {
  BoxIO.run();

}

BOX_WRITE(V9) {
  int level = param.asInt();
  Serial.println(level);
}

What you should see

The track runs from -10 at the bottom to 10 at the top. Serial prints the released value, including negatives.