Hi Guys
I am trying to read the values from my potentiometer. I got it working but the output is not really what I was expecting.
Firstly I dont understand the concept of the channels.
Like for example, you physically connect something to PIN 0, but instead of choosing PIN 0, you have to select Cpu.AnalogChannel.ANALOG_0.
Is there any user friendly documentation on this, but anyways back to my problem.
I was using some snippnets from 1 of the posts I found in the netduino forums, basically the guy was just reading values from the potentiometer. I would like to do the same. heres the potentiometer I have
http://netram.co.za/...entiometer.html
But this guy was setting a range in his example. (pot.setrange(0,100)) I dont have those options. and I just want round numbers and not decimals. I just want to read values from 0-100 also in my example. Heres my code. I does output the values but it starts like 1 2 3 then back to 1 2 3 and then if you turn it slightly, it jumps all the way to 202.
Only options I have for the AnalogInput is the following and what do they mean ? I have no clue.
It basically needs to be refine and optimized. Any ideas
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 NetduinoPotTester { public class Program { public static void Main() { AnalogInput pot = new AnalogInput(Cpu.AnalogChannel.ANALOG_0); while (true) { int potValue = 0; potValue = pot.ReadRaw(); Debug.Print(potValue.ToString()); } } } }
Thanks guys.