using System; using System.Net; using System.Net.Sockets; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.NetduinoPlus; namespace NetduinoPlusApplication1 { public class Program { static void Main() { Thread t = new Thread(RedCheck); t.Start(); OutputPort bLED = new OutputPort(Pins.GPIO_PIN_D5,false); OutputPort gLED = new OutputPort(Pins.GPIO_PIN_D6,false); OutputPort rLED = new OutputPort(Pins.GPIO_PIN_D9,false); AnalogInput Pot = new AnalogInput(Pins.GPIO_PIN_A0); AnalogInput PV = new AnalogInput(Pins.GPIO_PIN_A1); Pot.SetRange(5, 500); int PotValue = 0; while(true) { PotValue = Pot.Read(); gLED.Write(true); Thread.Sleep(PotValue); gLED.Write(false); PotValue = Pot.Read(); bLED.Write(true); Thread.Sleep(PotValue); bLED.Write(false); PotValue = Pot.Read(); rLED.Write(true); Thread.Sleep(PotValue); rLED.Write(false); } } static void RedCheck() { OutputPort CheckLED = new OutputPort(Pins.GPIO_PIN_D0, false); InputPort button = new InputPort(Pins.GPIO_PIN_A2, false, Port.ResistorMode.PullUp); bool buttonstate = false; while(true) buttonstate = !button.Read(); CheckLED.Write(buttonstate); } } }
Thank you for your input.
Edited by Chris Walker, 03 November 2012 - 10:01 PM.
added [code][/code] tags