Skip to content

Commit 4b1f7c7

Browse files
authored
Update SliderWidget.ino
1 parent 7136f9e commit 4b1f7c7

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

examples/CustomWidgets/SliderWidget/SliderWidget.ino

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,13 @@ CAYENNE_IN(VIRTUAL_CHANNEL)
4646
CAYENNE_LOG("Channel %d, pin %d, value %d", VIRTUAL_CHANNEL, ACTUATOR_PIN, value);
4747
// Write the value received to the PWM pin. analogWrite accepts a value from 0 to 255.
4848
analogWrite(ACTUATOR_PIN, value);
49-
}
49+
}
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)