本文整理汇总了C#中Microsoft.SPOT.Hardware.InterruptPort.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# InterruptPort.Dispose方法的具体用法?C# InterruptPort.Dispose怎么用?C# InterruptPort.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.SPOT.Hardware.InterruptPort
的用法示例。
在下文中一共展示了InterruptPort.Dispose方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public static void Run()
{
var servo = new ServoController(Pins.GPIO_PIN_D9, 600, 3000);
var button = new InterruptPort(Pins.ONBOARD_SW1, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth);
button.OnInterrupt += (data1, data2, time) =>
{
//servo.Duration = 1500;
if (data2 == 1)
servo.Rotate(100);
else
{
servo.Rotate(0);
}
};
while (Debugger.IsAttached)
{
Thread.Sleep(1000);
}
button.Dispose();
servo.Dispose();
}
示例2: Main
static void Main(string[] args)
{
SPI SPIport = new Microsoft.SPOT.Hardware.SPI(new Microsoft.SPOT.Hardware.SPI.Configuration(Cpu.Pin.GPIO_NONE, false, 0, 0, false, true, 2000, SPI.SPI_module.SPI1));
OutputPort nCE = new OutputPort(Cpu.Pin.GPIO_Pin2, true);
InterruptPort nINT = new InterruptPort(Cpu.Pin.GPIO_Pin4, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeLow);
NRF24L01Plus n = new NRF24L01Plus();
n.Initialize(SPIport, nCE, nINT);
byte[] address = n.GetAddress(AddressSlot.Zero, 5);
Console.WriteLine("First Address: " + ByteArrayToHexString(address));
byte[] b = new byte[] { 0x04, 0x09, 0x02, 0x03, 0x04 };
n.SetAddress(AddressSlot.Zero, b, false);
address = n.GetAddress(AddressSlot.Zero, 5);
Console.WriteLine("Second Address: " + ByteArrayToHexString(address));
nCE.Dispose();
nINT.Dispose();
}
示例3: Axis
public Axis(Cpu.Pin pin, Cpu.AnalogChannel analogChannel, double voltage)
{
_voltage = voltage;
var ax = new InterruptPort(pin, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth);
ax.Dispose();
_analogInput = new AnalogInput(analogChannel);
}