Label
Text on the page. Leave it unattached to keep the words you typed. Attach it to a pin when the sketch should replace the words.
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 Label.
- Type the words in Text.
- Leave Attach to a pin off for a fixed title. Turn it on, then set Device and Virtual pin, when a virtualWrite should change the words.
- Set Color and Font size. Opacity is useful when the label sits on top of another widget.
- Save the layout.
- 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 |
|---|---|---|---|---|
text | Dashboard or sketch | Plain text | Pump room | The words shown. On an attached label, a non-empty pin value is shown instead, and text is the fallback. |
color | Dashboard or sketch | #RRGGBB | #e8eef8 | Text color. |
detached | Dashboard | On means not attached to a pin | on | Unattached labels ignore the pin. Attached labels follow virtualWrite. |
label | Dashboard or sketch | Plain text | Pump | Caption above the widget. 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
- Unattached is the default. The Text field is what you see, and the pin boxes stay hidden.
- Attached: after the sketch calls virtualWrite, that string replaces the text. Clear or missing values fall back to the Text field, then to a sketch
setProperty(pin, "text", "..."). - Hide label is on by default for this widget because the text itself is the content.
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);
// Only used when the label is attached to V10.
BoxIO.setProperty(10, "text", "Waiting");
BoxIO.setProperty(10, "color", "#e8eef8");
BoxIO.virtualWrite(10, "Pump room");
}
void loop() {
BoxIO.run();
}
What you should see
An unattached label stays on the words you typed. An attached label on pin 10 changes when the sketch writes V10. There is no V10 macro; use the number 10.