peony3000

Gadgeteer Joystick LED Blink 06

Apr 2nd, 2012
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.05 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_06
  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.             // The incremental count will increase from 0 to 255 in steps of 1
  39.             for (int incrementCount = 0; incrementCount <= 255; incrementCount++)
  40.             {
  41.                 led.SetRedIntensity(incrementCount);
  42.                 led.SetGreenIntensity(incrementCount);
  43.                 led.SetBlueIntensity(incrementCount);
  44.  
  45.                 led.SetRedIntensity(255 - incrementCount);
  46.                 led.SetGreenIntensity(255 - incrementCount);
  47.                 led.SetBlueIntensity(255 - incrementCount);
  48.  
  49.                 Thread.Sleep(50);
  50.             }
  51.  
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment