Created
October 20, 2013 08:41
-
-
Save steenhulthin/7066592 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public partial class Program | |
{ | |
private static readonly int FirstLed = 0; | |
private static readonly int LastLed = 6; | |
private int _ledNumberToModify = FirstLed; | |
// This method is run when the mainboard is powered up or reset. | |
void ProgramStarted() | |
{ | |
Debug.Print("Program Started"); | |
FlashAllLedsOnce(); | |
var timer = new GT.Timer(100); | |
timer.Tick += timer_Tick; | |
timer.Start(); | |
} | |
private void FlashAllLedsOnce() | |
{ | |
led_Strip.TurnAllLedsOff(); | |
led_Strip.TurnAllLedsOn(); | |
Thread.Sleep(1000); | |
led_Strip.TurnAllLedsOff(); | |
} | |
void timer_Tick(GT.Timer timer) | |
{ | |
led_Strip.TurnLEDOff(_ledNumberToModify); | |
if (_ledNumberToModify == LastLed) _ledNumberToModify = FirstLed; | |
else _ledNumberToModify++; | |
led_Strip.TurnLEDOn(_ledNumberToModify); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment