.net micro framework的入门例程-点灯神话-1.神灯自闪

我是用的是GHI的G120模块,死贵死贵的,画了个小板自己玩,硬件对我来说没什么大问题,但单片机出身的人C#实在是弱爆了。

今天花了一整天学了IO控制、中断、定时、串口等。

做个记录,程序很简单,我觉得稍微一百度就能看明白,就没加注释。



这段代码是我COPY来的,用来检查我的硬件是否正确。

using System.Threading;
using GHIElectronics.Gadgeteer;
using Microsoft.SPOT.Hardware;

namespace FEZ_Panda_II_Application1
{
    public class Program
    {
        internal const int StateChangeDelay = 500;  //milliseconds  
        internal const Cpu.Pin port = (Cpu.Pin)GHI.Hardware.G120.Pin.P1_15; //连的LED灯,高有效

        public static void Main()
        {
            // Blink board LED  

            bool ledState = false;
            OutputPort led = new OutputPort(port, ledState);

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

                // toggle LED state  
                ledState = !ledState;
                led.Write(ledState);
            }
        }
    }
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值