I’m trying to send the equivalent of a Button/Switch via the HTTP API. I can successfully get the pin to go high, but it immediately returns low. Is there an option to the Set function I am missing? If I read the pin back, it says High even though the actual hardware pin is Low.
Board: LinkSprite LinkNode R4 (using ESP8266 generic)
Sample code for making the pin stay high appreciated.
The ESP8266 pin is connected to a relay. The relay turns on and immediately off when sent a /pin/value=1 from the HTTP interface. When sent from a Button/Switch in Blynk app, it stays on. For example… pin=Low, send HTTP value=1, pin=High, pin=Low, HTTP get/pin returns High, yet pin is low and relay is off. I’m wondering if there is a ‘Hold High’ or ‘Switch’ option to the HTTP API that I don’t see. How does the Android app tell the server the difference between Button/Push and Button/Switch?
I do have a widget on it, a Button / Switch set to digital / gp12. Is it possible that having an app widget is interfering with the HTTP API calls? The app works perfectly as is, but I need to control from another device (non-Blynk capable(? windows), so I was going to use the http api).
The phone app was not running when I was trying. But I went ahead and removed the button widget entirely from my phone app, resent the http call, and it did the same thing. Relay engaged, and immediately disengaged.
Can you post your code? Or are you just running the standalone code?
I just tried to use the HTTP API commands to turn on a relay at my house (a first for me). It seems to have worked OK (or so it seems). I am using and NodeMCU DEV Board with one of those single relay boards. The relay is controlling the water spigot for my dogs water bowl (hopefully i dont come home to a flooded backyard). It even updates the status of the button widget in the APP.
Using d12, d16, d14, and d13 fixed it. Not sure why I hadn’t tried that. It works correctly with the app now as well. Buttons in app update when HTTP sets values.
Thank you very much!