I'm a new user of the netduino plus board. But, and I think that was not a clever idea, I updated the firmware of my board to micro .net framework 4.2. My board is function very well. But now I'm trying the experiments in the nedx experimenters guide. The experiment for the temperature is using the analog pin 0.
In the code this is done by:
static AnalogInput tempSensor = new AnalogInput(Pins.GPIO_PIN_A0);
But this returns an error: The best overloaded method match for 'Microsoft.SPOT.Hardware.AnalogInput.AnalogInput(Microsoft.SPOT.Hardware.Cpu.AnalogChannel)' has some invalid arguments.
So switching to:
static AnalogInput tempSensor = new Microsoft.SPOT.Hardware.AnalogInput(Cpu.AnalogChannel.ANALOG_0);
But now my tempSensor.Read() return a double instead of an int.
Is there a difference between the analoginput in version 4.1 and 4.2?
Differences between micro .net framework 4.1 and 4.2
Started by tabbetje, Sep 16 2012 08:03 PM
2 replies to this topic
#1
Posted 16 September 2012 - 08:03 PM
#2
Posted 16 September 2012 - 08:46 PM
Hi tabbetje,
An AnalogInput class was added into the NETMF core with .NET MF 4.2.
You can use this new class (as you have done) and then multiply the value by 1023.
You can also add in SecretLabs.NETMF.Hardware.AnalogInput.dll as a reference to your project, and then declare your object with the full class name of SecretLabs.NETMF.Hardware.AnalogInput. That will give you the same object model and int return type as with .NET MF 4.1 (for full backwards compatibility).
Chris
#3
Posted 18 September 2012 - 11:28 AM
Chris, thanks a lot.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users