[Netduino系列教程]模拟输入
本帖最后由 奈何col 于 2013-10-16 00:30 编辑先占坑
//OpenJumper Netduino ADC
//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 OJNETDUINO
{
public class Program
{
//Arrays are groups of variables
static AnalogInput[] ai = new AnalogInput;
public static void Main()
{
ai = new AnalogInput(Cpu.AnalogChannel.ANALOG_0);
ai = new AnalogInput(Cpu.AnalogChannel.ANALOG_1);
ai = new AnalogInput(Cpu.AnalogChannel.ANALOG_2);
ai = new AnalogInput(Cpu.AnalogChannel.ANALOG_3);
ai = new AnalogInput(Cpu.AnalogChannel.ANALOG_4);
ai = new AnalogInput(Cpu.AnalogChannel.ANALOG_5);
double Input = 0;
while (true)
{
//Read the raw sensor value
for (int a = 0; a < 6; a++)
{
Input = ai.Read();
Debug.Print(Input.ToString());
}
Debug.Print("");
Thread.Sleep(500);
}
}
}
}
页:
[1]