Hi all-- My first time using an ESP32 (ESP-WROOM-32), and I’m not getting any pushbutton input. I have run a basic wavetable program which produces sound. Now I want a pushbutton to control when the program runs. Problem is that I can’t get the button to register in any way. I have a pushbutton with one end to GND, and one to pin 12. I’ve tried several different strategies to read button status, including the serial monitor DigitalReadSerial program , but the serial monitor doesn’t register any signal change (straight 0’s). And yes, I changed the int pinButton assignment to 12 before running the program.
Wiring is PIN12 → button - >GND on breadboard.
I’m totally confused by the many different pin names on all the ESP32 pinout diagrams I’ve found, and I’m wondering if I’m just using the wrong kind of pin? I know I’m missing something silly here. Thanks!
So did you try using another pin for your switch to see what happens, 13, 14 or 15 for instance ?
Wait I am confused..
“Wiring is PIN12 -> button - >GND on breadboard.”
Where is the positive input in your setup to give the PIN12 a “high” signal?
Welcome to the forum.
Please read the first post in any forum entitled how to use this forum.
Have you got a 10K pullup resistor fitted, between the input pin and 3.3V?
Thanks, all-- I totally missed on the wiring design for the button. Thanks for clarifying that for me. I definitely need to put in the pullup resistor and change the flow to 3.3->pulllup->button-> pin. Here's my new question, though: the button I have is two-pin, and all the tutorials I find on basic button use with a pull up or down resistor look like four pins in order to send the "button open" signal through the resistor.
Is it possible to do this with just a two-pin button, or do I need a four-pin? I see some reference to using an internal resistor by defining the input type as INPUT_PULLDOWN? This article, for example, seems to indicate that I can use most of the pins without an external resistor by using INPUT_PULLUP (with a few possible for _PULLDOWN)?
Check with a multimeter which pics are shorted when you press the button.
3.3 - resistor - pin - button - gnd.
I’ve tried several different strategies to read button status, including the serial monitor DigitalReadSerial program , but the serial monitor doesn’t register any signal change (straight 0’s). And yes, I changed the int pinButton assignment to 12 before running the program.
Step 1 is … follow their exact wiring. So, if they connect to pin 2 in their tutorial, then at least connect to pin 2 for a start. Just to make sure that the tutorial gets their point across, and to make sure that it all works — based on their exact set-up … to begin with.
It’s kind of like … if somebody is teaching us to connect to a particular pin, but we decide to go off on a tangent and connect to some other pin, then there could be a chance that things might not work as expected. If we first begin with something that works…we could then probably move on and re-configure the system to work with some other pin. And if that ‘other’ pin doesn’t work, we may even find out why it doesn’t work with just any pin.