When I run this code
using System; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware.NetduinoGo; namespace ShieldBase { public class Program { public static void Main() { NetduinoGo.ShieldBase sb = new NetduinoGo.ShieldBase(GoSockets.Socket5); Microsoft.SPOT.Hardware.InterruptPort ip = new InterruptPort(sb.Pins.GPIO_PIN_D7, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth); ip.OnInterrupt += new NativeEventHandler(ip_OnInterrupt); Thread.Sleep(Timeout.Infinite); } static void ip_OnInterrupt(uint data1, uint data2, DateTime time) { Debug.Print("ip_OnInterrupt()"); } } }
This statement gives an exception "An unhandled exception of type 'System.Exception' occurred in Microsoft.SPOT.Hardware.dll"
ip.OnInterrupt += new NativeEventHandler(ip_OnInterrupt);
The code (except for the ShieldBase) works perfect for the Netduino. Only other module attached to the NetduinoGo is a button at GoSocket1.
Project properties are:
Deployment – transport: USB
Deployment - Device: NetduinoGo_NetduinoGo.
Target framework is .NET Micro Framework 4.2
I've tried other pins with same result.
Any idea?
Thank you, Kristoffer