unkwntech

Netduino Go Police Lights

Apr 6th, 2012
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.40 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3. using Microsoft.SPOT;
  4. using Microsoft.SPOT.Hardware;
  5. using NetduinoGo;
  6. using SecretLabs.NETMF.Hardware;
  7. using SecretLabs.NETMF.Hardware.NetduinoGo;
  8. using Button = NetduinoGo.Button;
  9.  
  10. namespace NetduinoGo_Test
  11. {
  12.     public class Program
  13.     {
  14.         public static void Main()
  15.         {
  16.             RgbLed led = new RgbLed();
  17.             //Button button1 = new Button(GoSockets.Socket1);
  18.             //Button button2 = new Button(GoSockets.Socket3);
  19.             Potentiometer pot = new Potentiometer();
  20.             int muliplier = 2000;
  21.  
  22.             while(true)
  23.             {
  24.                 for (int i = 0; i < 5; i++)
  25.                 {
  26.                     led.SetColor(255, 0, 0);
  27.                     Thread.Sleep(20 * (int)(pot.GetValue() * 100));
  28.                     led.SetColor(0, 0, 0);
  29.                     Thread.Sleep(40 * (int)(pot.GetValue() * 100));
  30.  
  31.                 }
  32.  
  33.                 Thread.Sleep((int)(pot.GetValue() * muliplier));
  34.  
  35.                 for (int i = 0; i < 5; i++)
  36.                 {
  37.                     led.SetColor(0, 0, 255);
  38.                     Thread.Sleep(20 * (int)(pot.GetValue() * 100));
  39.                     led.SetColor(0, 0, 0);
  40.                     Thread.Sleep(40 * (int)(pot.GetValue() * 100));
  41.                 }
  42.  
  43.                 Thread.Sleep((int)(pot.GetValue() * muliplier));
  44.             }
  45.         }
  46.  
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment