Box IO

Self-hosted IoT for Arduino and ESP32.

Oval button

Same behavior as the round button, drawn as a wide pill. Caption, face text, values, and colors are separate properties.

Sample pin: V7

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 Oval button.
  4. Set Virtual pin to 7.
  5. Set Label, On text, Off text, the two values, and the four colors the same way as the round button.
  6. Save the layout, then open Live and click the button.
  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
labelDashboard or sketchPlain textRoundCaption above the button. This is not the word drawn on the face.
textOnDashboard or sketchPlain textGoWord on the face while the pin equals the on value.
textOffDashboard or sketchPlain textIdleWord on the face while the pin equals the off value.
onValueDashboard or sketchExact text the pin must matchgoClicking the button while it is off sends this string to the device.
offValueDashboard or sketchExact text the pin must match0Clicking the button while it is on sends this string. Default is 0.
sendValueDashboard or sketchSame text as onValuegoOlder name for the on value. If onValue is empty, sendValue is used.
colorOnDashboard or sketch#RRGGBB#2ee0c5Face background when on.
colorOffDashboard or sketch#RRGGBB#314057Face background when off.
textColorOnDashboard or sketch#RRGGBB#071018Face text color when on.
textColorOffDashboard or sketch#RRGGBB#e8eef8Face text color when off.
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 "boxio.krmsproducts.net"
#define BOXIO_PORT 5923

#include <BoxIOEsp32.h>

void setup() {
  BoxIO.begin(BOXIO_AUTH, WIFI_SSID, WIFI_PASS, BOXIO_HOST, BOXIO_PORT);
BoxIO.setProperty(V7, "label", "Oval");
  BoxIO.setProperty(V7, "textOn", "Stop");
  BoxIO.setProperty(V7, "textOff", "Run");
  BoxIO.setProperty(V7, "onValue", "stop");
  BoxIO.setProperty(V7, "offValue", "0");
  BoxIO.setProperty(V7, "sendValue", "stop");
  BoxIO.setProperty(V7, "colorOn", "#ff5d73");
  BoxIO.setProperty(V7, "colorOff", "#314057");
  BoxIO.setProperty(V7, "textColorOn", "#071018");
  BoxIO.setProperty(V7, "textColorOff", "#e8eef8");
}

void loop() {
  BoxIO.run();

}

BOX_WRITE(V7) {
  Serial.println(param.asStr());
}

What you should see

The caption is Oval. The face is Stop or Run. Serial prints stop or 0 when the button is clicked.