|
本帖最后由 奈何col 于 2013-10-16 00:29 编辑
老规矩~先挖坑,慢慢填
[mw_shl_code=csharp,true]
//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[21];
public static void Main()
{
//Setup all 21 LED OutputPorts, one for each connected pin
leds[0] = new OutputPort(Pins.GPIO_PIN_D0, false);
leds[1] = new OutputPort(Pins.GPIO_PIN_D1, false);
leds[2] = new OutputPort(Pins.GPIO_PIN_D2, false);
leds[3] = new OutputPort(Pins.GPIO_PIN_D3, false);
leds[4] = new OutputPort(Pins.GPIO_PIN_D4, false);
leds[5] = new OutputPort(Pins.GPIO_PIN_D5, false);
leds[6] = new OutputPort(Pins.GPIO_PIN_D6, false);
leds[7] = new OutputPort(Pins.GPIO_PIN_D7, false);
leds[8] = new OutputPort(Pins.GPIO_PIN_D8, false);
leds[9] = new OutputPort(Pins.GPIO_PIN_D9, false);
leds[10] = new OutputPort(Pins.GPIO_PIN_D10, false);
leds[11] = new OutputPort(Pins.GPIO_PIN_D11, false);
leds[12] = new OutputPort(Pins.GPIO_PIN_D12, false);
leds[13] = new OutputPort(Pins.GPIO_PIN_D13, false);
leds[14] = new OutputPort(Pins.GPIO_PIN_SDA, false);
leds[15] = new OutputPort(Pins.GPIO_PIN_SCL, false);
leds[16] = new OutputPort(Pins.ONBOARD_LED, false);
while (true)
{
for (int a = 0; a < 17; a++)
{
leds[a].Write(true);
}
Thread.Sleep(200);
for (int a = 0; a < 17; a++)
{
leds[17 - 1 - a].Write(false);
}
Thread.Sleep(200);
}
}
}
}[/mw_shl_code]
OutputPort 类即是一个数字输出类,要想让一个引脚变为输出状态
OutputPort temp= new OutputPort(Pins.GPIO_PIN_D0, false);
|
|