Skip to content

Commit a30a1c1

Browse files
authored
Update RelaySwitch.ino
1 parent 31f86f4 commit a30a1c1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

examples/Actuators/RelaySwitch/RelaySwitch.ino

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,13 @@ CAYENNE_IN(VIRTUAL_CHANNEL)
4949
else {
5050
digitalWrite(ACTUATOR_PIN, LOW);
5151
}
52-
}
52+
}
53+
54+
// This function is called at intervals to send data to Cayenne and keep the device online.
55+
// Will create a temporary green widget on Channel 0, make it permanent by clicking on '+'.
56+
CAYENNE_OUT(0)
57+
{
58+
CAYENNE_LOG("Send data for Virtual Channel 0");
59+
// This command writes the device's uptime in seconds to the Virtual Channel.
60+
Cayenne.virtualWrite(0, millis() / 1000);
61+
}

0 commit comments

Comments
 (0)