peony3000

Gadgeteer LED 03 (While)

Mar 6th, 2012
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.30 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_03
  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.             // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
  35.             Debug.Print("Program Started");
  36.            
  37.             // We can create all sorts of holders that contain things that might vary during the operation of the instructions
  38.             // Create a simple number counter to look at to see where we are
  39.             int incrementalCounter = 0;
  40.             // A condition loop to check the number against
  41.             // Carry on looping while the value of incrementalCounter is less than 255
  42.             while (incrementalCounter < 255)
  43.             {
  44.                 led.SetBlueIntensity(incrementalCounter);
  45.                 led1.SetBlueIntensity(incrementalCounter);
  46.                 Thread.Sleep(500);
  47.                 // Some maths to add an increase to the counter
  48.                 incrementalCounter = incrementalCounter + 1;
  49.                 //this can be written quickly as "incrementalCounter++"
  50.             }
  51.         }
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment