Re: ESP8266-01 : Connect a button on GPIO2
Posted: Mon Jun 08, 2020 8:13 am
Is there a pull up resistor on the GPIO?
If not then when you release the button then the GPIO is essentially just floating and could be any value.
Either put a pull up e.g. 10K from GPIO to 3.3V or change the pinMode to INPUT_PULLUP. The latter will use an internal pull up of around 36K which is OK providing the leads to the button are reasonably short.
If not then when you release the button then the GPIO is essentially just floating and could be any value.
Either put a pull up e.g. 10K from GPIO to 3.3V or change the pinMode to INPUT_PULLUP. The latter will use an internal pull up of around 36K which is OK providing the leads to the button are reasonably short.