Hi everyone,
Im new here, and also to Arduino, and I have been learning quite a lot from here! I do have a question, and I hope this is the right thread!
So, I have an Arduino Uno, in that Arduino I connect pin 2 to a button and then the other side of the button goes to the ground!
Then the code goes like this:
int sigPin = 2;
void setup(){
pinMode(sigPin, INPUT);
Serial.begin(9600);
}
void loop(){
Serial.println(digitalRead(sigPin));
}
The issue is, that I would expect the serial to spit ou 1's until I press the button and while the button is pressed I would expect 0's, but, I get a random value showing without pressing the button, 0's and 1', just randomly switching, and, if I press the button I get the 0's I expected! what might this be?
Greetings,
Guilherme Menescal Dantas