Hello, sorry for my English but I have a problem with my Arduino Due.
If I try to read the status of an Arduino button returns incorrect values ??.... What can it be??
I write the code below, the circuit diagram and the one that gives me back unless I hit the button:
Program:
int x;
void setup()
{
Serial.begin(9600);
pinMode(40,INPUT);
}
From your diagram, it looks like when the button is pressed the line is pulled up to 3.3V, but when it is open, the input is floating so its value can vary. You might want to add a pull-down resistor so that the input is definitely low when the button isn't being pressed.