Hi All, I developed a code to get the temperature readings from TMP36 sensor. My Netduino was working properly. After 5 hours, I started debugging again, but it throwed exceptions (on the line voltagePort = new SecretLabs.NETMF.Hardware.AnalogInput(Pins.GPIO_PIN_A1)):
A first chance exception of type 'System.ArgumentException' occurred in Microsoft.SPOT.Hardware.dllAn unhandled exception of type 'System.ArgumentException' occurred in Microsoft.SPOT.Hardware.dll
The code of mine is here:
using System;using Microsoft.SPOT;using Microsoft.SPOT.Hardware;using SecretLabs.NETMF.Hardware;using SecretLabs.NETMF.Hardware.NetduinoPlus;namespace TMPSensor{ public class Sensor:Constants { //Microsoft.SPOT.Hardware.AnalogInput voltagePort; SecretLabs.NETMF.Hardware.AnalogInput voltagePort; OutputPort lowPort, highPort; public Sensor() { //Temperature sensor //voltagePort = new AnalogInput(AnalogChannels.ANALOG_PIN_A1); voltagePort = new SecretLabs.NETMF.Hardware.AnalogInput(Pins.GPIO_PIN_A1); lowPort = new OutputPort(Pins.GPIO_PIN_A0, false); highPort = new OutputPort(Pins.GPIO_PIN_A2, true); } public double read() { double rawValue = voltagePort.Read(); double value = (rawValue * maxVoltage) / maxAdcValue; double result = (((value - 0.5) * 1000) / 10) - 4; return result; } }}
The firmware of my Netduino Plus is 4.2.0.0 (RC5), and the SDK is MicroFrameworkSDK_NETMF42_QFE2. Any help or comment is highly appreciated. Mohammad