[Netduino系列教程]数字输出
本帖最后由 奈何col 于 2013-10-16 00:29 编辑老规矩~先挖坑,慢慢填
//Netduino 数字输出功能
//测试控制器:Netduino plus 2
//OpenJumper
//www.openjumper.com
using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;
namespace OpenJumper
{
public class Program
{
//Arrays are groups of variables
static OutputPort[] leds = new OutputPort;
public static void Main()
{
//Setup all 21 LED OutputPorts, one for each connected pin
leds = new OutputPort(Pins.GPIO_PIN_D0, false);
leds = new OutputPort(Pins.GPIO_PIN_D1, false);
leds = new OutputPort(Pins.GPIO_PIN_D2, false);
leds = new OutputPort(Pins.GPIO_PIN_D3, false);
leds = new OutputPort(Pins.GPIO_PIN_D4, false);
leds = new OutputPort(Pins.GPIO_PIN_D5, false);
leds = new OutputPort(Pins.GPIO_PIN_D6, false);
leds = new OutputPort(Pins.GPIO_PIN_D7, false);
leds = new OutputPort(Pins.GPIO_PIN_D8, false);
leds = new OutputPort(Pins.GPIO_PIN_D9, false);
leds = new OutputPort(Pins.GPIO_PIN_D10, false);
leds = new OutputPort(Pins.GPIO_PIN_D11, false);
leds = new OutputPort(Pins.GPIO_PIN_D12, false);
leds = new OutputPort(Pins.GPIO_PIN_D13, false);
leds = new OutputPort(Pins.GPIO_PIN_SDA, false);
leds = new OutputPort(Pins.GPIO_PIN_SCL, false);
leds = new OutputPort(Pins.ONBOARD_LED, false);
while (true)
{
for (int a = 0; a < 17; a++)
{
leds.Write(true);
}
Thread.Sleep(200);
for (int a = 0; a < 17; a++)
{
leds.Write(false);
}
Thread.Sleep(200);
}
}
}
}
OutputPort 类即是一个数字输出类,要想让一个引脚变为输出状态
OutputPorttemp= new OutputPort(Pins.GPIO_PIN_D0, false);
页:
[1]