Go Down

Topic: analogRead (Read 1 time) previous topic - next topic


Nov 07, 2010, 10:19 pm Last Edit: Nov 07, 2010, 10:27 pm by cnash44 Reason: 1

In an arduino mega analog pins are consistently displaying value with no hardware connected.

Test code is below, with serial monitor results.
 All pins have this behavior of reading values ~300 without input.

 I am expecting zero, any hints?
 Is something broken?

Thanks, cnash.

const int Pin1 = 3;    

void setup() {

void loop(){
   ANALOG_PRESS_LEVEL = analogRead(Pin1);
   Serial.print(", ");

ALIVE_#390, 335, 329, 327, 325, 324, 324, 324, 323, 323, 323, 324,


As the pins are not connected to 0V or 5V the are floating just in between. Connecting a resistor between pin and GND helps.

Please read this tutorial that explains all http://arduino.cc/en/Tutorial/DigitalPins
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)


Thank you. My mistake. Corrected many months ago with the information referenced. Porting proof of concept to prototype introduced pull-down-resistor wiring error(trying to combine them). This indeed was the solution.

Best Regards,

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131