Input pin always reading high

For some reason pin 13 is reading a high value even when the button is not pressed. I read that this is because of electromagnetic waves in the air and to make it read zero it needs to connect to ground, but I’m not sure how to wire it correctly. I tried connecting the breadboard socket J9 to the negative terminal and it worked the first time but now it’s reading high again.

First thing you need to do is disconnect everything except for a single button and make sure you fully understand how to use that button before even thinking of messing with all the other buttons and the display.

Follow this tutorial:

Then this one:

Then this one:

Make sure you fully understand the circuit and every line of code before moving on to the next project.

johnmp832:
[…] but I’m not sure how to wire it correctly.

The following diagram might help you to figure out the structure of a typical IO (input and output) line and then to proceed with the connection of a switch/button (K1) with an input line. The diagram also contains an output device (the RN2A-L circuit) which is permanently connected with DPin-13 of UNO.

Yes, we can see pin 13 is high because the on board LED is illuminated. The most logical explanation is that your code, which you did not post, is forcing pin 13 to be an output and writing a one to it.

Please post your code using code tags. See topic #7: How to use this forum

Hi,
Welcome to the forum.

Can you post your code please?

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Do you have a DMM to measure some circuit voltages?

Thanks.. Tom... :slight_smile:

johnmp832:
For some reason pin 13 is reading a high value even when the button is not pressed. I read that this is because of electromagnetic waves in the air and to make it read zero it needs to connect to ground, but I’m not sure how to wire it correctly.

No, it’s not “electromagnetic waves in the air”, it’s because it is a very high impedance input and you have nothing connected to ever make it LOW; you only have a button connected to pull it HIGH - via resistor with no evident purpose.

But that said, you should not connect buttons to the positive rail. Just connect them from the Arduino pin and ground. Then define the pin to which they are connected as pinMode(thispin, INPUT_PULLUP) to use the pull-up internal to the Arduino.

c9c33cdf48bc86bb101b0cee602e1249c44fa9ea.jpg