Hiya... just working my way through various tutorials... and am beginning to suspect that all is not well with this arduino (duemilanove ATmega 168).
So I wrote a little programme to test input on every pin...
/*
- Switch test program
*/
int s1 = 1;
int s2 = 2;
int s3 = 3;
int s4 = 4;
int s5 = 5;
int s6 = 6;
int s7 = 7;
int s8 = 8;
int s9 = 9;
int s10 = 10;
int s11 = 11;
int s12 = 12;
int s13 = 13;
void setup() // run once, when the sketch starts
{
Serial.begin(9600); // set up Serial library at 9600 bps
pinMode(s1, INPUT);
pinMode(s2, INPUT);
pinMode(s3, INPUT);
pinMode(s4, INPUT);
pinMode(s5, INPUT);
pinMode(s6, INPUT);
pinMode(s7, INPUT);
pinMode(s8, INPUT);
pinMode(s9, INPUT);
pinMode(s10, INPUT);
pinMode(s11, INPUT);
pinMode(s12, INPUT);
pinMode(s13, INPUT);
}
void loop() // run over and over again
{
Serial.print(digitalRead(s1));
Serial.print(digitalRead(s2));
Serial.print(digitalRead(s3));
Serial.print(digitalRead(s4));
Serial.print(digitalRead(s5));
Serial.print(digitalRead(s6));
Serial.print(digitalRead(s7));
Serial.print(digitalRead(s8));
Serial.print(digitalRead(s9));
Serial.print(digitalRead(s10));
Serial.print(digitalRead(s11));
Serial.print(digitalRead(s12));
Serial.print(digitalRead(s13));
Serial.println("");
delay(100);
}
And when I upload it - with absolutely nothing connected to the board, it outputs this:
1110000000000
1110000000000
1110000000000
1110000000000
1110000000000
1110000000000
1110000000000
1110000000000
1110000000000
1110000000000
Which makes it look as though the first 3 pins are permanently receiving "1"
Is that what it's supposed to do?
It also does this thing where if I set any of the 0 pins above to high, not only does that pin go to 1, but several of the neighbouring ones do as well.
Any help most appreciated
Nick