- Wed May 04, 2016 3:08 am
#46843
For my reed switch I solved it by declaring GPIO 0 as output, pull it low in setup and use it instead of ground to connect the switch to. Additionaly you might add a 2k2-10k resistor between GPIO 0 and 3.3V to have GPIO 2 high or floating during boot up (depending on the switch position).
In my case the ESP boots up fine regardless of GPIO 0/2 being pulled up or floating initially (I do keep RST permanently pulled high with 10k). GPIO 2 is used as input_pullup, sensing for high or low states:
ESP Reed Switch.jpg
This one got me in the right direction on that topic.
Just remember - for my purpose, GPIO 0 has no other use than being pulled low, the ESP(V1) sends push messages to my phone on switch changes. You might want to have a further look if you need GPIO 0 doing other stuff than just providing a steady ground connection after boot up.
Code: Select allvoid setup() {
pinMode(2, INPUT_PULLUP); // One reed wire at GPIO 2
pinMode(0, OUTPUT); // Other reed wire at GPIO 0 which provides...
digitalWrite(0, LOW); // ...ground after booting
(...)
}
You do not have the required permissions to view the files attached to this post.