您的位置:首页 > 其它

.net micro framework的入门例程-点灯神话-2.按键控制LED灯

2014-05-02 18:01 183 查看
按键用内部上拉,按下接地。

LED灯高电平有效。

using System.Threading;

using GHIElectronics.Gadgeteer;

using Microsoft.SPOT.Hardware;

namespace FEZ_Panda_II_Application1

{

public class Program

{

public static void Main()

{

Cpu.Pin lampPin = GHI.Hardware.G120.Pin.P1_15;

Cpu.Pin switchPin = GHI.Hardware.G120.Pin.P2_10;

OutputPort lampOutput = new OutputPort(lampPin, false);

InputPort switchInput = new InputPort(switchPin, false, Port.ResistorMode.PullUp);

while (true)

{

lampOutput.Write(switchInput.Read());

}

}

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: