i have a leonardo, and i guess it has some problem on serial communucation.
i wrote a small program
void setup() {
Serial.begin(9600);
pinMode(5,INPUT);
}
int but1=0;
void loop() {
but1=digitalRead(10);
Serial.println(but1);
delay(100);
}
when i give 5 volts to pin 10(i tried almost all pin 1,3,5,6,7,8,11), on serial print always 1 but when i take out 5 volts, on screen 1 and 0 changing randomly
, 15 second 0,
10 second 1,
2 second 0,
3 times 1...
also i just realize when i give 5 volts, a little bit later, for a small duration "0" coming, than turns to 1, after little bit later again for small duration 0 coming and it happining agian and again..
dear carlmikael, english is not my native language, so pls use simple english
i want wrote a program, when i push button led will open, and when i push again led will close, but i couldn't read the button 0 or 1...
when there is nothing connected to pin 10, screen 1 and 0 changing randomly, when i give 5v (on arduino 5v pin) to pin 10, generally on screen 1, for a small duration 0 coming than turns 1...
dear awol i just seen to code tags, thank you.
what do you mean with "floating pin".
when there is no cable on arduino(there was a bread board with leds and button, i take out all the cable from arduino), on screen i seen 1-0 randomly, what pull up resistor will changes. i mean without anything, numbers are coming randomly, isnt this a problem?