Hello!
I would like to emulate a push button switch to ground. I can do that with this :
pinMode(powerButton, INPUT);
digitalWrite(powerButton, LOW);
pinMode(powerButton, OUTPUT); // Pull the signal low to activate the power button
delay(100);
pinMode(powerButton, INPUT); // Release the power button.
BUT, can I do that with EspEasy?
How to emulate push button switch to ground
Moderators: grovkillen, Stuntteam, TD-er
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: How to emulate push button switch to ground
What do you mean? Please explain more...
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: How to emulate push button switch to ground
Please review the GPIO commands explained here:I would like to emulate a push button switch to ground. I can do that with this : {snip}
https://www.letscontrolit.com/wiki/index.php/GPIO
I see that you require the emulated switch to be Hi-Z when not active (driven low). So the built-in GPIO pulse command cannot be used. The workaround is to use discrete GPIO commands and a system timer. Unfortunately the system timer only has 1000mS resolution so the switch will be active for 1 second minimum.
Here is a set of rules that will activate GPIO14 by calling Event SendSwitch
Code: Select all
on System#Boot do
GPIO,14,2 // Hi-Z GPIO 14
endon
on Rules#Timer=4 do
GPIO,14,2 // Hi-Z GPIO 14
endon
on SendSwitch do
timerSet,4,1
GPIO,14,0
endon
Important: Do not connect anything directly to a GPIO pin that could drive the pin higher than 3.3V. Otherwise the ESP8266 can be damaged.
- Thomas
Re: How to emulate push button switch to ground
Thank you Thomas, that will probably do the trick. Just to be clear: I would like to parallel connect the ESP GPIO to the LED controller push buttons.
Also, thanks for 3.3V tip. I will have to use the level shifter.
BR
Bojan
Also, thanks for 3.3V tip. I will have to use the level shifter.
BR
Bojan
Re: How to emulate push button switch to ground
Instead of a typical level shifter you could use a simple NPN or FET transistor buffer circuit. This would allow you to use the GPIO Pulse command which would simplify your rules and allow 100mS switch On times.
- Thomas
- Thomas
Re: How to emulate push button switch to ground
Yes, that is probably the simplest solution. Thanks a lot.
Bojan
Bojan
Who is online
Users browsing this forum: No registered users and 34 guests