Advanced Button

The same button as the Simple Button, with a label, an icon, and — the part that matters — a value of your choice for each gesture. When 1 and 0 are not what the device wants to hear, this is the button to place.
What it does
It writes to its signal on three gestures — press, release, long press — and you decide what each one sends. A fan button can send 255 on press and 0 on release; a preset button can send 3. In Momentary mode (the default) press and release are two events; in Toggle mode each tap alternates between the press value and the release value.
When to use it
- A preset — one tap sends a fixed value: a scene, a speed, a mode number.
- Full speed while held — press sends
255, release sends0. - Two actions on one button — a short press and a long press that do different things, each with its own value.
Set it up
- Place it — In edit mode, tap + at the bottom of the dashboard and choose Advanced Button under Controllers.
- Wire it to a signal — Tap the button, open the Data tab, tap + Add a target and pick an Integer signal on your device.
- Set the values — In the same tab, under What each gesture sends, type the number you want for a press, a release and a long press —
255,0and128for a fan, say. - Dress it and try it — In the Appearance tab, give each gesture a label and an icon. Close the settings, tap ▶, and press the button.
Settings
Tap the widget in edit mode: the sheet opens with a live preview at the top, then two tabs — Data for what it reads or writes, Appearance for how it looks.
Data — what it writes
Targets
| Setting | Type | Default | What it controls |
|---|---|---|---|
| Targets | list of signals | empty — No target yet. The tap goes nowhere. | The signal the widget writes to. Accepts an Integer or Decimal signal — the values you set for each gesture are numbers. The picker lists nothing else. + Add a target for a second device: every target gets the value. |
Mode
| Setting | Type | Default | What it controls |
|---|---|---|---|
| Mode | Momentary / Toggle | Momentary | Momentary: press then release, two events. Toggle: each tap alternates between the Press value and the Release value. |
What each gesture sends
| Setting | Type | Default | What it controls |
|---|---|---|---|
| Press | number | 1 |
The value written on press. |
| Release | number | 0 |
The value written on release. |
| Long press | number | 2 |
The value written when the press lasts half a second. |

Appearance — how it looks
Title
| Setting | Type | Default | What it controls |
|---|---|---|---|
| Title text | text | empty | A title above the widget. Empty means no title. |
| Alignment | Left / Center / Right | Center | Where the title sits. |
Press
| Setting | Type | Default | What it controls |
|---|---|---|---|
| Label | text | empty | The text on the button while pressed. |
| Icon | icon picker | led | An icon next to the label. |
| Background | colour | theme accent | |
| Text | colour | theme |
Release
| Setting | Type | Default | What it controls |
|---|---|---|---|
| Label | text | Button | The text at rest. |
| Icon | icon picker | led | |
| Background | colour | theme | |
| Text | colour | theme |
Long press
| Setting | Type | Default | What it controls |
|---|---|---|---|
| Label | text | empty | The text while a long press is registered. |
| Icon | icon picker | led | |
| Background | colour | theme | |
| Text | colour | theme |

States
- Edit mode — a tap opens the settings.
- Run mode — the button changes label, icon and colours as you press, hold and release, so you see which gesture registered.
- Device offline — a gesture is never replayed.
Arduino device code
The address is all the device knows — I0 here; use the one the app gave your signal. In the sketch, the block that runs on every gesture — or ISignal(I0, int v) if you only care about the number:
IAdvancedButton(I0) {
WHEN_PRESSED { … }
WHEN_RELEASED { … }
WHEN_LONG_PRESSED { … }
};
Complete sketch — Cloud
Paste it into the Arduino IDE, put your Wi-Fi and the token the app gave you, upload.
#include <InstantIoT.h>
const char* WIFI_SSID = "MyWiFi";
const char* WIFI_PASS = "MyPassword";
const char* DEVICE_TOKEN = "PASTE_TOKEN_HERE";
const int FAN = 5;
IAdvancedButton(I0) {
WHEN_PRESSED { analogWrite(FAN, 255); } // full speed while held
WHEN_RELEASED { analogWrite(FAN, 0); }
WHEN_LONG_PRESSED { analogWrite(FAN, 128); } // half speed, and it stays
};
void setup() {
Serial.begin(115200);
pinMode(FAN, OUTPUT);
InstantIoT.begin(WiFiLink(WIFI_SSID, WIFI_PASS), Cloud(DEVICE_TOKEN));
}
void loop() {
InstantIoT.loop();
}
Other connections
The widget block never changes. Only the begin() line says how the device reaches the app:
| Connection | begin() |
Devices |
|---|---|---|
| Cloud over Wi-Fi (above) | InstantIoT.begin(WiFiLink("MyWiFi", "secret"), Cloud(DEVICE_TOKEN)); |
ESP32 family, ESP8266, UNO R4 WiFi, MKR WiFi 1010, Nano 33 IoT, UNO WiFi Rev2 |
| Cloud over Ethernet | InstantIoT.begin(EthernetLink(), Cloud(DEVICE_TOKEN)); |
any board + an Ethernet shield |
| Direct — the device’s own Wi-Fi | InstantIoT.begin(AccessPoint("MyESP32", "12345678")); |
every board with Wi-Fi |
| Direct — Bluetooth LE | InstantIoT.begin(BLELink("MyESP32")); — #include <NimBLEDevice.h> first |
ESP32 family (not the S2) |
| Direct — Bluetooth Classic | InstantIoT.begin(BluetoothLink("MyESP32")); |
the original ESP32, Android only |
| Direct — a Bluetooth module (HC-05, HM-10) | InstantIoT.begin(SerialLink(Serial1)); — or SerialLink(13, 15) on ESP8266, SerialLink(10, 11) on UNO / Nano |
every board, radio or not |
| Your own InstantIoT Server (open source, at home) | InstantIoT.begin(WiFiLink("MyWiFi", "secret"), MyServer("192.168.1.42", DEVICE_TOKEN)); |
same as Cloud |
Direct needs no token: the phone is at the other end of the wire. See Connect for TLS, timeouts and what to do when it does not connect.
ISignaldoes the same job — and survives a restart.ISignal(I0, int v)runs with exactly the same value asIAdvancedButton(I0): the widget block is the readable form,ISignalthe generic one, and you can use either. The difference shows when the device reconnects: with Restore after a restart on the signal, the Cloud sends the last value again and only theISignalblock runs — a gesture is not replayed. If the value is what matters after a restart (a preset), read it withISignal(I0, int v)and turn Restore on: the device gets the last preset back by itself. See One block for everything.
Notes
- If you only need the number,
ISignal(I0, int v)is shorter than threeWHEN_clauses:vis whatever the gesture sent. - The icon list is long; type the first letters in the picker to find one.
Next
→ Simple Button — when 1 and 0 are enough
→ Segmented Switch — several fixed values, side by side