Input box
Someone types on the dashboard and presses Send. The sketch receives that text in BOX_WRITE. Use pins 0–31 so the library can deliver it.
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 Input box.
- Set Virtual pin to
4. - Set Label, Color on, and Color off. Color on is the text and the Send button. Color off is the box border.
- Save the layout, then open Live. Edit mode does not send.
- Type a message and press Send. The sketch handler for V4 runs on the next
BoxIO.run(). - 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 |
|---|---|---|---|---|
colorOn | Dashboard or sketch | #RRGGBB | #2ee0c5 | Typed text color and Send button color. |
colorOff | Dashboard or sketch | #RRGGBB | #314057 | Border color of the text box. |
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
- The dashboard sends the text exactly as typed, including spaces. The sketch reads it with
param.asStr(), orparam.asInt()/param.asFloat()when the text is a number. - The field clears after Send. It does not echo the pin by itself.
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(V4, "label", "Input Lab");
BoxIO.setProperty(V4, "colorOn", "#2ee0c5");
BoxIO.setProperty(V4, "colorOff", "#314057");
}
void loop() {
BoxIO.run();
}
BOX_WRITE(V4) {
String text = param.asStr();
Serial.println(text);
BoxIO.virtualWrite(V1, text);
}
What you should see
Send on the dashboard prints the text on Serial and copies it to a Value box on V1 if you added one. The handler only runs when loop keeps calling BoxIO.run().