按键用内部上拉,按下接地。
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());
}
}
}
}