Skip to content

Commit ea04837

Browse files
authored
Update ButtonWidget.ino
1 parent 4b1f7c7 commit ea04837

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

examples/CustomWidgets/ButtonWidget/ButtonWidget.ino

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,12 @@ CAYENNE_IN(VIRTUAL_CHANNEL)
4747
// Write the value received to the digital pin.
4848
digitalWrite(ACTUATOR_PIN, value);
4949
}
50+
51+
// This function is called at intervals to send data to Cayenne and keep the device online.
52+
// Will create a temporary green widget on Channel 0, make it permanent by clicking on '+'.
53+
CAYENNE_OUT(0)
54+
{
55+
CAYENNE_LOG("Send data for Virtual Channel 0");
56+
// This command writes the device's uptime in seconds to the Virtual Channel.
57+
Cayenne.virtualWrite(0, millis() / 1000);
58+
}

0 commit comments

Comments
 (0)