Horizontal line
A horizontal stroke on the page. Change its color and its width. Drag the box to change how long it is.
Set it up on the server
- Sign in to the Box IO dashboard and open the project that uses this device key.
- Turn on Edit.
- In Edit, add Horizontal line.
- Set Color to the stroke color.
- Set Width to the thickness in pixels, from 1 to 64. A new line is 8 pixels.
- Drag the corner to make the line longer or shorter. The box height does not change the stroke. Width does.
- Background starts transparent, so only the stroke shows. Pick another background if you want a fill behind it.
- Save the layout. The line is drawn by the dashboard. It does not use a virtual pin.
- Flash the sketch below with the same device key, host, and port
5923. KeepBoxIO.run()inloop().
Properties
Sketch values are always strings, including numbers: BoxIO.setProperty(V2, "max", "200").
| Property | Where to set it | Format | Example | Effect |
|---|---|---|---|---|
color | Dashboard | #RRGGBB | #e8eef8 | Stroke color. |
lineWidth | Dashboard | Whole number 1 to 64 | 8 | Thickness of the stroke in pixels. |
background | Dashboard | #RRGGBB or the word transparent | transparent | Fill of the widget box. Transparent leaves only the stroke. |
label | Dashboard or sketch | Plain text | Pump | Caption above the widget, taken from the label saved on that widget. A sketch setProperty for label does not rename it. On a round or oval button this is the caption, not the word on the button face. |
hideLabel | Dashboard | On or off | checked | Hides the caption. Button face text, meter numbers, and label text stay visible. |
fontSize | Dashboard | Whole number 8 to 160, or blank for automatic size | 28 | Text size in pixels inside the widget. |
opacity | Dashboard | 10% to 100% | 70% | Lets an overlapping widget show through. 100% is solid. |
Formatting
- Width is the stroke. The widget box is the length. Resize the box to change how far the line reaches.
- The line is centered in the box. A width larger than the box is drawn as thick as the box allows.
- There is no virtual pin and no sketch call. Hide label is on, so the caption stays off unless you turn it back on.
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);
// A horizontal line is drawn on the dashboard.
// Set its color and width in Edit. The sketch does not drive it.
}
void loop() {
BoxIO.run();
}
What you should see
A horizontal stroke in the color and width you set. Changing Width makes it thicker or thinner. Dragging the box makes it longer or shorter.