Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

from netduino plus a netduino plus 2


  • Please log in to reply
1 reply to this topic

#1 winterMB

winterMB

    New Member

  • Members
  • Pip
  • 3 posts

Posted 25 February 2013 - 05:10 PM

using System;
using System.IO;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;
using Toolbox;
using Toolbox.NETMF;
using Toolbox.NETMF.NET;
using Microsoft.SPOT.IO;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
 
 
namespace lavaggio_mani
{
    public class Program
    {
 
        //declaration
 
        static string terminale = "porttest";
        static OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);
        static OutputPort motore = new OutputPort(Pins.GPIO_PIN_A0, false);
 
        static InterruptPort button1 = new InterruptPort(Pins.GPIO_PIN_A3, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeLevelLow);
        static InterruptPort button2 = new InterruptPort(Pins.GPIO_PIN_A4, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeLevelLow);
        static InterruptPort button3 = new InterruptPort(Pins.GPIO_PIN_A5, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeLevelLow);
 
 
        static InterruptPort OnBoardButton = new InterruptPort(Pins.ONBOARD_SW1, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeHigh);
 
        public static void Main()
        {
 
 
 
            button1.OnInterrupt += new NativeEventHandler(button1_OnInterrupt);
            button2.OnInterrupt += new NativeEventHandler(button2_OnInterrupt);
            button3.OnInterrupt += new NativeEventHandler(button3_OnInterrupt);
 
            OnBoardButton.OnInterrupt += new NativeEventHandler(button_OnInterrupt);
 
            SetTime();
 
            Thread.Sleep(Timeout.Infinite);
        }
 
 
 
now generate:
 
An unhandled exception of type 'System.ArgumentException' occurred in Microsoft.SPOT.Hardware.dll
 
on           button1.OnInterrupt += new NativeEventHandler(button1_OnInterrupt);
 
please help!
 
mb


#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 26 February 2013 - 10:07 AM

Hi mb, InterruptEdgeLevelLow isn't supported yet in the STM32 core. If you want to catch InterruptEdgeLow instead and then disable your interrupt after the first event you should get an equivalent experience. Welcome to the Netduino community, Chris P.S. For best performance, I would recommend using pins D2-D13 for interrupts.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.