InterruptPort FlowMeterPulse = new InterruptPort(Pins.GPIO_PIN_D1, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeHigh);
The error is:
An unhandled exception of type 'System.Exception' occurred in Microsoft.SPOT.Hardware.dll
The code is:
public class Program { //Flow Meter Settings public const int INTERRUPT_TIMER_MS = 30000; public static long pulsebuffer = 0; public static double TotalFlow; public static TimerCallback timerDelegate = new TimerCallback(TimeProcessEvents); public static Timer FlowMeterTimer; // public static ; public static void Main() { InterruptPort FlowMeterPulse = new InterruptPort(Pins.GPIO_PIN_D1, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeHigh); FlowMeterPulse.OnInterrupt += new NativeEventHandler(FlowMeterPulse_OnInterrupt); FlowMeterTimer = new Timer(timerDelegate, null, 0, INTERRUPT_TIMER_MS); //Thread FlowManagerThread = new Thread(new ManagerInterrupt().Initialize); //FlowManagerThread.Start(); Server WebServer = new Server(PinManagement.OnboardLED, 80); while (true) { PinManagement.OnboardLED.Write(true); Thread.Sleep(100); PinManagement.OnboardLED.Write(false); Thread.Sleep(2400); } } /// <summary> /// /// </summary> /// <param name="state"></param> private static void TimeProcessEvents(object state) { double meanFlow = (double)((double)7.5 * (double)pulsebuffer / (double)30); TotalFlow += meanFlow * 0.5; } public static void FlowMeterPulse_OnInterrupt(uint data1, uint data2, DateTime time) { pulsebuffer++; } }
I'm using the .NETMF 4.2