As i was using the on board switch i got it working by doing the following:
public static InterruptPort button1; public static void Main() { button1 = new InterruptPort(Pins.ONBOARD_SW1, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeLevelLow); WaitForButtonPress(); } private static void WaitForButtonPress() { Debug.Print("Waiting for button press..."); button1.ClearInterrupt(); button1.OnInterrupt += new NativeEventHandler(button1_OnInterrupt); while (true) { Thread.Sleep(15); } } private static void button1_OnInterrupt(uint data1, uint data2, DateTime time) { Debug.Print("Onboard button pressed"); WaitForButtonPress(); }
This might be of interest - a general purpose button class. http://nerduino.word...1/02/24/button/ (derived from http://geekswithblog.../09/142211.aspx )