Help with setting up a timer (of some sort)

HI
Not a programmer, but I need some help please. I am willing to try different codes, just to make this work. Your help and time are highly appreciated.
This will be to execute a button press on a coffee machine. I have already connected a relay (external 5v) to D7 and it turns the coffee machine on. Currently I am doing this with Tinker, but I need it to be totally manageable via Alexa/Google home.

I need to turn Photon pin D7 on (high) for 5 seconds and turn it off (low) again. Wait 10 minutes and turn in on for 5 seconds and off again. (The button is a push to make - turn machine on and push again to turn it off. The relay does this just fine, but as I have it now, it is manual and bounded to Tinker)
Can anyone please help me with code like this, it should not be that complicated for coders like yourself?
Also, I need to be able to publish this to Samsung Smartthings, so this whole process can be activated via Alexa/Google home.

Thanks for your help.

What exactly is it you need assistance with?
-timing function on the device?
-connecting to smart platform? If so, which one?

For the timing you could look into things like:
-delay
-millis counter
-software timers
-timer libraries

1 Like

HI

As mentioned - both. I am not a programmer and need help with coding this.
Also, This needs to be published to the Smartthings platform

Thank you.

Is this something you want to tackle yourself, or do you need us to do it for you? In general, we try to help people achieve their goals on their own, not do their work for them, just so you know.

I’d split the project up in two things, the first being the timing on the device, the second being the connection to whatever smart platform you need.
If you take a look at some of the tutorials about calling functions and combine that with the various options I mentioned in my previous post, that ought to go a long way towards getting the device part done.
Once you have that working, we can start looking into connecting it.

This is a good tutorial to get familiar with functions and variables: Tutorial: Spark Variable and Function on One Web Page
Mind the fact that it’s a bit older, and some things need to be updated to the most recent status, for which the documentation is a great place to look.
Additionally, it’s now possible to call functions/variables from the Particle Console and/or the phone app, so you don’t necessarily have to worry about the website part.

Take a look, play around with some code and let us know where you get stuck, if you do.

Additionally, it never hurts to do a quick web search on the topic you’re struggling with, so no one has to reinvent the wheel: https://community.smartthings.com/t/control-particle-photon-with-smartthings-app/97582/

3 Likes

Hi

I totally understand that I cannot expect from anyone to help me with coding this. What you have given me is a very good start and I will shout when I get stuck.

Thank you!

1 Like

For the timing part I’d go with this
https://docs.particle.io/reference/device-os/firmware/photon/#software-timers

Especially the one_shot option.