Analogue in question

Hi,
I have a Panda 3 with SKD 4.3 and VS 2013.
The anologue input pins on the board equate as follows A0 … Analogue_2, A1…Analogue_3 etc. Not a big problem, but unusual they start 2 up.
With the code below I thought I would get close to 4096 for 3.3v and 0 for 0v.
I seem to be getting numbers between zero and one.
Y2 = 0.0004884004884004884 this is the input at ground.
Y2 = 0.99926739926739927 this is the input at 3.3v
Is there a way to configure the port to supply numbers from 0 to 4069?


using System;
using System.Threading;

using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GHI.Pins;

namespace Joystick
{
    public class Program
    {
        #region static variables
        static AnalogInput Y2 = new AnalogInput((Cpu.AnalogChannel)Cpu.AnalogChannel.ANALOG_2);  // A0 on the board      
        #endregion //static variables

        public static void Main()
        {            
            while (true)
            {
                Debug.Print("Y2 =  " + Y2.Read().ToString()); 
                Thread.Sleep(500);
            }
        }
    }
}

You should use GHI.Pins.FEZPands… to get the right analog channel.

And correct, the returned value is 0 to 1. I can’t remember the method name but I think there was a way to read the raw data but why would you need that? 0 to 1 is easier to deal with and will be the same on any board you are using.

Thanks Gus, that makes sense.

Alastair