当前位置: 首页>>代码示例>>C#>>正文


C# InterruptPort.EnableInterrupt方法代码示例

本文整理汇总了C#中Microsoft.SPOT.Hardware.InterruptPort.EnableInterrupt方法的典型用法代码示例。如果您正苦于以下问题:C# InterruptPort.EnableInterrupt方法的具体用法?C# InterruptPort.EnableInterrupt怎么用?C# InterruptPort.EnableInterrupt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.SPOT.Hardware.InterruptPort的用法示例。


在下文中一共展示了InterruptPort.EnableInterrupt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        public static void Main()
        {
            var button = new InterruptPort(Pins.ONBOARD_SW1, true, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth);
            button.OnInterrupt += new NativeEventHandler(Button_OnInterrupt);
            button.EnableInterrupt();

            while (true)
            {
                if (_active)
                    UploadData(new AnalogInput(Cpu.AnalogChannel.ANALOG_2));
            }
        }
开发者ID:kenlefeb,项目名称:Netduino-Spikes,代码行数:12,代码来源:Program.cs

示例2: Pulsante

 /// <summary>
 /// Parte l'evento dell'interruzione quando il livello del segnale di interruzione è alto (ovvero quando il pulsante viene premuto).
 /// Se si usa un bottone diverso dal built-in, è necessario collegare delle resistenze di pull-down per l'interruttore .
 /// Lady Ada è un eccelente tutorial su questo argomento: http://www.ladyada.net/learn/arduino/lesson5.html
 /// </summary>
 /// <param name="pin">Un pin digitale collegato al pulsante.</param>
 /// <param name="intMode">Definisce il tipo di cambio di livello innescando l'evento dell'interrupt.</param>
 /// <param name="target">Il gestore di eventi viene invocato quando si verifica un interrupt.</param>
 /// <param name="resistorMode">Configurazione interna della resistenza di pullup.</param>
 /// <param name="glitchFilter">Ingresso filtro antirimbalzo.</param>
 public Pulsante(Cpu.Pin pin, Port.InterruptMode intMode = Port.InterruptMode.InterruptEdgeLow, 
                 NativeEventHandler target = null, Port.ResistorMode resistorMode = Port.ResistorMode.Disabled,
                 bool glitchFilter = true)
 {
     Input = new InterruptPort(pin, glitchFilter, resistorMode, intMode);
     if (target == null)
     {
         Input.OnInterrupt += InternalInterruptHandler;
     }
     else
     {
         Input.OnInterrupt += target;
     }
     Input.EnableInterrupt();
 }
开发者ID:gamondue,项目名称:GrowBox-5F-16,代码行数:25,代码来源:Pulsante.cs

示例3: Main

        public static void Main()
        {
            try {
                var timeSet = false;
                NTP.UpdateTimeFromNtpServer("pool.ntp.org", 1);

                ReadConfiguration();
                ReadValueCache();

                loggingEndpoint = HttpClient.GetIPEndPoint(loggingHostName, loggingPortNumber);

                s0Port = new InterruptPort(Pins.GPIO_PIN_D12, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeLow);
                s0Port.OnInterrupt += new NativeEventHandler(S0PulseReceived);
                s0Port.EnableInterrupt();

                var messageReader = new P1MessageReader();
                messageReader.MessageReceived += new P1MessageReader.MessageReceivedDelegate(messageReader_MessageReceived);
                messageReader.Start();

                while (true) {
                    Thread.Sleep(60000);

                    // Resync time and s0Counter at 3 o'clock at night
                    if (!timeSet && System.DateTime.Now.Hour == 3) {
                        timeSet = NTP.UpdateTimeFromNtpServer("pool.ntp.org", 1);
                        s0Counter = 0;
                    } else if (timeSet && System.DateTime.Now.Hour > 3) {
                        timeSet = false;
                    }

                    CacheValuesOnSd();
                }
            } catch (Exception ex) {
                Debug.Print(ex.ToString());
            }
        }
开发者ID:petergerritsen,项目名称:netduino-p1-logging,代码行数:36,代码来源:Program.cs

示例4: Bumper

 public Bumper(Cpu.Pin interruptPin)
 {
     interruptPort = new InterruptPort(interruptPin, true, Port.ResistorMode.PullDown, Port.InterruptMode.InterruptEdgeHigh);
     interruptPort.OnInterrupt += InterruptPortOnInterrupt;
     interruptPort.EnableInterrupt();
 }
开发者ID:ducas,项目名称:Robbo,代码行数:6,代码来源:Bumper.cs


注:本文中的Microsoft.SPOT.Hardware.InterruptPort.EnableInterrupt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。