Netduino home hardware projects downloads community

Jump to content

The Netduino forums have been replaced by new forums at This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

AnalogInput read problems

  • Please log in to reply
3 replies to this topic

#1 hookedup



  • Members
  • PipPip
  • 20 posts
  • LocationFlorida - USA

Posted 04 October 2010 - 09:25 PM

I just got my netduino today and my first goal was to read some input using an analog pin.

After getting just 1023 for all readings, I tried to simply hook up the analog pin to ground and read the value in the loop. The reading should be zero every time but it is not.

Code in the main loop ...
AnalogInput inputPin = new AnalogInput(Pins.GPIO_PIN_A0);
            while (true)

- When I use port A0 - I get values like 255,127 and a few 0 and 1023 values (not consistent)
- When I use port A1 or A2 - I get 1023 all the time.

Just to make things interesting .. I hookedup the ground from an arduino and it reads zero most of the time. It still reads an occasional 1023 reading.

To recreate - just hook a wire from Analog 0 to any ground and run the code. If you get zero every time .. I'd have to say hardware issue or version mismatch of some type?

This seemed like a pretty straight forward test but being brand new to this environment I figured I'd make my first newbie post :)

#2 MattW



  • Members
  • PipPip
  • 23 posts

Posted 04 October 2010 - 10:06 PM

I had the same problem. Check this topic about AREF and check the wiring picture for AREF. That's what fixed it for me. http://forums.netdui...rch__1#entry192 Have fun!

#3 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 04 October 2010 - 10:29 PM

hookedup, To echo what MattW said, the ARM chip on the Netduino does not have an internal AREF like the AVR on the Arduino has... Simply attach AREF to the 3.3V header and all should be well... Chris

#4 hookedup



  • Members
  • PipPip
  • 20 posts
  • LocationFlorida - USA

Posted 04 October 2010 - 10:56 PM

HA! A newbie problem with an easy fix, that did it! I love being a newbie again .. it feels good. Thanks - great community!

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.