Button

Docs / Widgets / Controls / Button
Control widget

Button

A Button sends a command when you press it. Use Push for things that act only while held, like a buzzer or a motor jog. Use Switch mode when each tap should flip the state.

Dashboard → devicePush or Switch modeSends 1 / 05 looks · 8 icons

Try it

Press and hold the button. In Push (Momentary) mode the buzzer sounds only while you hold it. Change Button Action to Switch (Latching) and each tap flips it instead. Then try the shapes, looks and icons — they are the same settings as in the widget's settings window.

SimulationLIVE
Dashboard
This is the real widget from the dashboard.
Your device
NuttyFiMCU · Wi-FiONLINENUTTYFITP0Buzzer: OFF
The board reads the Telemetry Point and drives the buzzer.
Button Action
Button Shape
Button Style
Icon
Widget Color
Show
Push sends two valuesIn Push mode the button sends 1 when you press and 0 when you let go. If the connection drops while you hold it, your code should treat a missing 0 safely, for example with a timeout.

How to add and set up

  1. Open the dashboard in edit modeOpen the device and turn on editing.
  2. Add a ButtonPress + on the right edge of the canvas and pick Button. Drag it into place.
  3. Open its settingsClick the gear icon on the widget. The window title shows the widget's name.
  4. Link a Telemetry PointUnder Linked Telemetry Points, pick the point your code reads, for example TP0.
  5. Choose the action and lookSet Button Action to Push (Momentary) or Switch (Latching), pick a Button Shape, Button Style and Icon, then save and press DONE.

Settings

SettingWhat it does
Widget NameThe title shown on the widget.
Label ColorColour of the title.
Linked Telemetry PointsThe Telemetry Point (TP0, TP1…) the widget uses. Your device code uses the same point.
Button ActionPush (Momentary): sends 1 while pressed, 0 when released. Switch (Latching): each tap flips between 1 and 0.
Button ShapeRound / Circle or Square / Rectangular.
Button StyleFlat (default), 3D (sinks when on), Outline, Label (text inside) (icon and text in a pill) or Glass (frosted). 3D and Label need Starter or above.
IconAuto (hand in Push mode, power in Switch mode), Power, Bulb, Fan, Pump / Water, Lock, Bell or Play / Pause. Fan, Pump / Water, Lock, Bell and Play / Pause need Starter or above.
ON / OFF labelText shown in each state. Defaults: ON and OFF.
ON / OFF text colourColour of that text in each state.
Widget ColorColour of the button when it is on, and of the tile's border.
Hide widget Name / Telemetry Point / Widget BorderHide the title, the TP badge or the outline around the tile.

Push or Switch?

1
Pressed / ONPush: while held · Switch: after a tap
0
Released / OFFPush: when you let go · Switch: next tap
UseMode
Buzzer, horn, motor jog, garage door pulsePush (Momentary)
Light, fan, pump that should stay onSwitch (Latching)

Receive commands on your device

Your board picks the value up with SME_LISTEN on the linked point. The examples use TP0.

C++ · Arduino
SME_LISTEN(TP0)
{
  digitalWrite(BUZZER_PIN, data.toInt());   // 1 while held, 0 when released
}

SME_LISTEN(TP0) runs every time the dashboard writes TP0. data holds the value it sent, as text: use data.toInt() for whole numbers or data.toFloat() for decimals.

Keep it shortDo the work and return. Long delay() calls inside SME_LISTEN hold up the connection.

These are snippets. Your sketch also needs #include <SMEIoT.h>, SME.begin(...) in setup() and SME.run() in loop(). The full sketch tab shows a complete example; see the SDK quick start for more.

Was this page helpful?