Hi guys,
totally new here and to Arduino, this seemed like the place to go for an answer to my weird question.
So the weirdness:
First of, my idea was to let the led respond to the button. Nothing fancy in the code, just hadn't placed the button yet.
What happens however, is that the led responds to my finger hovering over pin 2 (programmed as the button).
Any thoughts on this?
Here is the link to a youtube movie in which I show the problem. The code is under there.
int led = 13;
int button = 2;void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
pinMode(button, INPUT);
}void loop() {
int sensorValue = digitalRead(button);
if(sensorValue == 1){
digitalWrite(led, HIGH);
} else {
digitalWrite(led, LOW);
}
}
Thanks in advance!
Cheers