I have a Netduino Plus 2 board and I would like to use one of its analog input to read value from a temperature sensor.
For my tests, I connect the pin A0 to ground then to +3.3V and I read the value, it's always something between 0.2xxV and 0.7xxV.
The code U use is:
Microsoft.SPOT.Hardware.AnalogInput pinA0 = new Microsoft.SPOT.Hardware.AnalogInput(Cpu.AnalogChannel.ANALOG_0); double temperature = pinA0.Read();I guess the pin referenced by
Cpu.AnalogChannel.ANALOG_0is not the good one (meaning wiring).
I also tried this to define the pin as:
SecretLabs.NETMF.Hardware.AnalogInput pinA0 = new SecretLabs.NETMF.Hardware.AnalogInput(Pins.GPIO_PIN_A0); int temperature = pinA0.Read();But then I get a runtime exception:
An unhandled exception of type 'System.ArgumentException' occurred in Microsoft.SPOT.Hardware.dll
on the pin's definition line...
If I continue executing the code untill I read the pin, I see that pinA0 is "null".
Any idea on how to correctly define the A0 pin please?
Thanks!