Skip to content

Commit 7136f9e

Browse files
authored
Update ValveSwitch.ino
1 parent 4db598e commit 7136f9e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

examples/Actuators/ValveSwitch/ValveSwitch.ino

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

0 commit comments

Comments
 (0)