Analog Input
The aim of this experiment was to test the analog input. The simplest way I could think of to do this is to hook up a potentiometer to one of the analog pins and then display the values using the debugger.
First task is to wire up the board. The final wiring looked like this:
I say final wiring as my initial version looked a little different. The first version did not have the 3.3V output connected to Aref and as a result I found myself getting very odd results from the analog input pin.
The code to read data from the Netduino looks like the following:
public static void Main()
{
AnalogInput analog;
analog = new AnalogInput(Pins.GPIO_PIN_A1);
analog.SetRange(0, 1023);
while (true)
{
Debug.Print(analog.Read().ToString());
Thread.Sleep(1000);
}
}
Running the application and turning the potentiometer results in a range of values from 0 to 1023.
Tags: Electronics, Netduino
Saturday, February 12th, 2011 at 6:14 pm • Analog, Electronics, Netduino • RSS 2.0 feed Both comments and pings are currently closed.