Here is the issue I have, I am using a Netduino 1 to control (4) LEDs.
I need each LED to flash at a different rate.
Below is the code I have created so far.
Here is my issue. The brth() Thread.sleep(x) seems to be controlling everything. I need to run each of these subs independently so if I adjust brth() it won't affect tLed(), mLed(), or bLed(), or where none of the others affect each other.
The bottom line question. What did I do wrong?
Thank you in advance for your help.
Oh, forgot to mention the bad news. I need this working in 2 days. Yeah. I just had this idea. I'm an idiot.
using System; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.Netduino; namespace VaderChestBox { public class Program { // Variables //Digital Inputs //Digital Outputs static OutputPort led1 = new OutputPort(Pins.GPIO_PIN_D1, true); static OutputPort led2 = new OutputPort(Pins.GPIO_PIN_D2, false); static OutputPort led3 = new OutputPort(Pins.GPIO_PIN_D3, true); static OutputPort breath = new OutputPort(Pins.GPIO_PIN_D4, false); //Analog Inputs //Analog Outputs public static void Main() { // write your code here while (true) { tLed(); mLed(); bLed(); brth(); } } public static void tLed() { // flash Top LED (LED1). 1.5 second cycle 50% duty. led1.Write(!led1.Read()); Thread.Sleep(750); } public static void mLed() { // flash Middle LED (LED2). 3.7 second cycle 50% duty. led2.Write(!led2.Read()); Thread.Sleep(1850); } public static void bLed() { // flash Bottom LED (LED3). 2.35 second cycle 50% duty. led3.Write(!led3.Read()); Thread.Sleep(1175); } public static void brth() { // Trigger Breath Module. 5.1 second cycle 2% duty. breath.Write(true); Thread.Sleep(100); breath.Write(false); Thread.Sleep(5000); } } }