Button wiring and declaration with the esp8266

hello and thanks for the help in advance im brand new so please take it a little easy on me,im trying to have a pin from the esp8266 read the input of a button then turn on the led on a different pin of the esp,the problem is im trying to figure out what off and on is ? does HIGH mean ON and LOW mean OFF? or vice versa because whenever i ask if pin is high turn on led it is always reading the pin as high and whenever i tell it to turn led on if low it never reads the button as high so the real problem is i guess its not reading the button press at all?

below is a picture of my wiring again thanks in advance =)

and also i know about external resistor and pullup/pull down resistors and when ive used the on board pull up and pull down i receive more success but im trying to get the fundementals down first and i know in the future not all boards i work with will have built in resistors on the pins i need,i also head that the esp has "inverted logic" so i think that may also be the cause of my aliment please help me not go crazy thank you

my wiring is like this but with a esp8266 on gpio 10

That depends on how you wire the circuit

1 Like

If i have the input pin tied to ground and the other side of the button to 3v3/vcc what would be the correct choice to it on when pressed?

Have you got a resistor in the circuit ?

If not then it sounds like GND and 3V3 will be shorted when the button is pressed. At best this will reset the board. At worst it will damage the board

For clarification please post a diagram of your wiring. A photo of a hand drawn circuit is good enough

I did post the diagram if you look above its there and yes 10k resistor on ground

The resistor will prevent the direct short but are you sure that you have the switch connected correctly ?

The button pins are in pairs and you may have used a pair of connected pins, hence no switch action. To be sure that that you have actually connected to a pair of switched pins use two diagonally opposite pins on the switch

Yes im connected correctly just as the diagram shows im just trying to figure high/low state

The easy way is to check it programmatically, sending a signal if either HIGH or LOW, but from your schematic. Un-pressed the pinstate should read LOW, pressed it should read HIGH.

The issuse is when i ask the code to read high it reads high no matter what,if pressed or not it doesnt matter and when i ask it to read low it never registers the press it always ignores the if clause and nothing happens

The diagram does not show that. Any 2 adjacent pins on such a button could be either permanently connected or switched. Personally I would use diagonally opposite pins to be sure

1 Like

I have tried it in 4 configurations and no luck

So how about you show us what pin you have connected the button to.


Is that the pin marked 'SD3' ?
and how you have referred to in the code (that you haven't shown us so far..)

Yes it sd3 or GPIO 10 the code i am using is a button basic code from the arduino sketechbook example sorry cant upload right now im on mobile but it is basic sketch

dont drink and code. (defined the wrong pin)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.