I know this is ridiculously simple task but I spent the last two hours trying to get this to work and it is not working. I don't have an Arduino but I have an ESP8266 Huzzah Feather which is programmable via the Arduino IDE. So, I don't think I can provide a Fritz diagram but in any case, I'm just trying to hook up a pushbutton and be able to read a HIGH or LOW (via my Serial monitor). Currently, everything is 0.
As best I can describe it is:
5V from Feather into resistor into one terminal of the pushbutton. Out the other terminal of the pushbutton is a wire connecting to pin 12 of the Feather, and also a wire leading to ground. Feather is also grounded.
My code is:
void setup()
{
Serial.begin(9600);
pinMode(12, INPUT);
}
void loop()
{
int button_val = digitalRead(12);
Serial.println(button_val);
}
It shouldn't be this hard for me. Whenever I open and run the serial monitor, it reads 0s. What am I missing?
Oh, an issue that I faced is determining which 2 out of the 4 terminals of the pushbutton to use. Some resources I find say that it is the same side as the terminal the voltage is flowing into; other resources say it is the terminal opposite to the side the voltage is flowing into. I currently have it opposite.