Simple problem
Closed this issue · 2 comments
MVFarkas commented
Hi guys,
I have a problem... i just need to turn on/off my device, however i just know how to do it on FauxmoESP.
An example: I need to turn on/off a light, on the fauxmoESP i just define the relay/lamp pin and use the "state" function to turn on/off the relay/lamp by the digitalWrite function.
How can i do it on the espalexa code? Does the espalexa have a function to "check" the state?
Thanks in advance.
Aircoookie commented
Hi!
Yes, just use an EspalexaDevice object like device3
in the EspalexaBasic example.
Then you can use device->getValue()
. If the device is off, this will be 0, so you can just do bool isOn = device->getValue()
:)
MVFarkas commented
Oh god, thanks 👍