Is there a reason that my UNO R3 board would return random values on a simple analogread()? This is a simple case of having a routine that only reads A0 (or Ax) and the monitor reads random values in the 300's. No other pins are pushed high or low. There are no leads or any devices attached to the board. I would think that each reading should produce only a zero. Am I missing something?
I would think that each reading should produce only a zero. Am I missing something?
Yes. Your assumption that a analog input pin should read zero when nothing is wired to it is wrong. Also reading a digital input and assuming it will return a zero with nothing wired to it would also be wrong. In both cases those unwired pins would be stated as having a floating input pin condition and will just return values randomly and unpredictably as they respond to random input electrical noise. The world of electronics is quite different then the world of software. Wire the analog input pin to ground and then you will see a valid 0 value returned.