I just got a simple scheme where i have a button connected to the 5V connector and to the 4th digital PIN and then i got a led connected to the 2nd PIN and to the GND. When i press the button the LED should switch on and when i don't press it, it shouldn't bright. The problem here is that i got a True value when i'm not pressing the button. What could it be? Here goes the code:
int Button=0;
void setup() {
Serial.begin(9600);
pinMode(2, OUTPUT);
pinMode(4, INPUT);
}
void loop() {
Button = digitalRead(4);
Serial.println(Button);
if (Button == HIGH) {
digitalWrite(2, HIGH);
} else {
digitalWrite(2, LOW);
}
delay(200);
}