Echo & Alexa User Discussions and Support Forums

When a person is not breathing, permanent brain damage begins after 4 minutes and death in 6 minutes after that. Can you count on help arriving before that time? Learning proper CPR techniques is easy and you can learn it in 30 minutes at CPR Test Center.

How to switch on, delay,then switch off a device

0 Members and 1 Guest are viewing this topic.

How to switch on, delay,then switch off a device
« on: June 08, 2021, 09:22:41 am »
I have a device acting as a simple switch. I can use Alexa to switch it on, and also to switch it off.
I want a single command to ask Alexa to switch it on, leave it on for 2 seconds, then switch it off. (without the need to issue an "off" command).
Alexa would then be ready to receive the same "switch on" command to perform the same result at a later date.
Anyone know whether this is possible?

Re: How to switch on, delay,then switch off a device
« Reply #1 on: June 08, 2021, 11:09:45 am »
Ah, solved it. I was using the "delay" function and find there is an issue with this in the Arduino IDE (see other posts/forums). I've used a "while" loop and millis() and it works fine now.