Hello I am using this simple code that I have used so many times before:
const int buttonSwitchA=9;
void setup()
{
Serial.begin (57600);
pinMode(buttonSwitchA, INPUT);
}
void loop()
{
buttonStateA=digitalRead(buttonSwitchA);
if (buttonStateA==HIGH) {
Serial.println("printing");
delay(1000);
}
}
I have a switch in my breadboard. One pin is in the 5V and the other is my "free" pin. My switch works fine because I checked with using a voltometer, when i press the switch and measured voltage the free pin. (basiccally i do not know how to explain this but I used that mode when there is path, you hear the beep sound. When switch is pressed sound is heard, otherwise not).
So my switch works.
When i plug in the free pin in the arduino input 9, it always read HIGH and prints the message. I tried wit other inputs but still nothing.
Is it a problem of code or what should I checked?