peony3000

Gadgeteer LED Function

Mar 13th, 2012
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.03 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3. using Microsoft.SPOT;
  4. using Microsoft.SPOT.Presentation;
  5. using Microsoft.SPOT.Presentation.Controls;
  6. using Microsoft.SPOT.Presentation.Media;
  7. using Microsoft.SPOT.Touch;
  8.  
  9. using Gadgeteer.Networking;
  10. using GT = Gadgeteer;
  11. using GTM = Gadgeteer.Modules;
  12. using Gadgeteer.Modules.GHIElectronics;
  13.  
  14. namespace Gadgeteer_LED_chain_02
  15. {
  16.     public partial class Program
  17.     {
  18.         // This method is run when the mainboard is powered up or reset.  
  19.         void ProgramStarted()
  20.         {
  21.             /*******************************************************************************************
  22.             Modules added in the Program.gadgeteer designer view are used by typing
  23.             their name followed by a period, e.g.  button.  or  camera.
  24.            
  25.             Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
  26.                 button.ButtonPressed +=<tab><tab>
  27.            
  28.             If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
  29.                 GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
  30.                 timer.Tick +=<tab><tab>
  31.                 timer.Start();
  32.             *******************************************************************************************/
  33.  
  34.  
  35.             // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
  36.             Debug.Print("Program Started");
  37.  
  38.             lightLed(led);
  39.             lightLed(led1);
  40.             lightLed(led2);
  41.         }
  42.        
  43.         private void lightLed(MulticolorLed ledName)
  44.         {
  45.             if (ledName.PositionOnChain == 1)
  46.             {
  47.                 ledName.SetBlueIntensity(255);
  48.             }
  49.             else if (ledName.PositionOnChain == 2)
  50.             {
  51.                 ledName.SetGreenIntensity(255);
  52.             }
  53.             else if (ledName.PositionOnChain == 3)
  54.             {
  55.                 ledName.SetRedIntensity(255);
  56.             }
  57.         }
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment