hi. cayenne community. hope someone can help me. i want a device to turn on by physically pressing the widget button but i want it to turn off automatically after 5 seconds without having to press it again. In my sketch, I used a delay of 5000 then used digitalwrite to turn it off. it worked in that the device turned off but still the widget is set to on. How can i modify my sketch so that after 5 seconds, the devices turns off and the widget button at the same time. here is a portion of my sketch. Hope u guys can help me.
int value = getValue.asInt();
CAYENNE_LOG(“Channel %d, pin %d, value %d”, VIRTUAL_CHANNEL_MEDIUMCOF, ACTUATOR_PIN_MEDIUMCOF, value);
// Write the value received to the digital pin.