Hello all,
I've been playing with the analog input on my netduino, and I had been playing with it for quite a bit thinking that I had been using it wrong. Turns out... I was! When using a potentiometer to regulate the voltage into my analog input, I noticed that as I approached the upper end (higher voltages of my potentiometer) the value being printed from the .Read() of my analog input started to decline. I just learned today that that was due to using the 5 V pin on the board as my source and the highest value accurately registered through the .Read() was when the voltage was 3.3 V. I was curious if there was a way to allow for accurate measures of voltages higher than 3.3 volts via AnalogInputs (nothing necessarily too crazy... but how about the 5 volt pin?) I would appreciate any input on the subject.
Thanks for taking the time to read this.
Good luck and good thought,
woof_woof_bark_bark
PS. this is how I set up my code while using the 3.3 V pin as the source to my potentiometer providing me with an output that is between 0-1 (the voltage as a percent of 3.3 V). When I would use 5 V as the source and change AnalogReference_float to 5 as well; my output would be 0-1 (when at or below 3.3 V) and 1 - 0.6 (when voltage to the analog input pin was 3.3 V - 5 V) The biggest desire is to at least figure out - if possible - how to change the percentage ie: I would love to make the output a voltage as a percent of X as opposed to being locked into 3.3V.
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;
namespace AnalogTest
{
public class Program
{
private const float AnalogReference_float = 3.30f;
static AnalogInput pot = new AnalogInput(AnalogChannels.ANALOG_PIN_A0);
public static void Main()
{
while (true)
{
Debug.Print("Raw Value: " + pot.Read()*AnalogReference_float);
Debug.Print("");
}
}
}
}