I am trying to simply toggle the Status of a pin (D7) via a IFTTT DO Button.
I can call either a function directly on the Photon or publish an event which the Photon will listen to.
However i would prefer an Option where i can call a function directly.
Press the IFTTT DO Button once -> D7,HIGH (LED on) -> Press the IFTTT DO Button again -> D7,LOW (LED off) -> and so on
I am just overwhelmed by the Information available, but especially the Toggle Aspect seems to be complicated as i found multiple solutions online. Can Anyone help?
Toggling an LED shouldn’t be too hard. The easiest way is by checking the current state of the pin, and then inversing that. I’ve written a quick (untested!) demo in <30 seconds, which you could give a try.
Nobody asked for it to be useful
Considering it’s regarding IFTTT DO, there’s very little use for a useful return, but yes, your approach is generally more elegant
But then you might also argue that you shouldn’t actually do stuff in a function call, other than setting a flag and reacting to it in the loop