My very first Arduino arrived in the mail today, and it already seems to have a mind of its own!
Looking at the code below, I'm using pin 12 as an input, and pin 11 as an output. Pin 12 is pulled down during initialization, and during the main loop, yet when I poll the read register it returns high some of the time. A common serial output would be 0,0,0,1,1,1,1,0,1,1,1,1,0,1,1 for instance, sometimes changing on it's own, although handling the device seems to provoke changes too.
I have found this only happens when pin 11 is outputting high. If I remove pin 11 from the code, or replace pin 11 with any other pin (10,9,etc), there is no problem.
So my first thought was a short on the board. I examined the board, scraped off any loose hairs, everything looks clean. I buzzed it with a DMM and it couldn't detect any short, infinite impedance.
Now I'm at a loss for what to do. I was so excited to start on some projects. Any suggestions? (I purchased from Lady Ada btw)
Thanks,
Erc
int inputPin = 12;
int outputPin = 11;
int status;void setup() // run once, when the sketch starts
{
pinMode(outputPin, OUTPUT);
pinMode(inputPin, INPUT);
digitalWrite(outputPin, HIGH);
digitalWrite(inputPin, LOW);
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}void loop() // run over and over again
{
digitalWrite(outputPin, HIGH);
status = digitalRead(inputPin);
Serial.println(status);
delay(1000);
}