예제 #1
0
 static void Clock(Transmitter AN)
 {
     DateTime Time = DateTime.Now;
     byte sec_part = (byte)((Time.Second / 60f) * 60f);
     byte min_part = (byte)((Time.Minute / 60f) * 60f);
     byte hr_part = (byte)((Time.Hour / 24f) * 24f);
     Console.Write(hr_part.ToString() + "-");
     Console.Write(min_part.ToString() + "-");
     Console.WriteLine(sec_part.ToString());
     for (int i = 0; i < 60; i++)
     {
         byte R = (sec_part >= i) ? (byte)255 : (byte)0;
         Pixel Clk = new Pixel(R, 0, 0);
         AN.setPixel(i, Clk);
     }
     for (int i = 60; i < 120; i++)
     {
         byte G = (min_part + 60 >= i) ? (byte)255 : (byte)0;
         Pixel Clk = new Pixel(0, G, 0);
         AN.setPixel(i, Clk);
     }
     for (int i = 120; i < 144; i++)
     {
         byte B = (hr_part + 120 >= i) ? (byte)255 : (byte)0;
         Pixel Clk = new Pixel(0, 0, B);
         AN.setPixel(i, Clk);
     }
     for (int i = 144; i < 150; i++)
     {
         Pixel Clk = new Pixel(128, 0, 128);
         AN.setPixel(i, Clk);
     }
     //byte G = (min_part >= i) ? (byte)255 : (byte)0;
     //byte B = (hr_part >= i) ? (byte)255 : (byte)0;
     AN.sendData();
 }
예제 #2
0
        static void RandomColor(Transmitter an)
        {
            Random RNG = new Random();
            byte[] colors = new byte[3];

            for (int j = 0; j < 150; j++)
            {
                RNG.NextBytes(colors);
                int R = colors[0] % 3 * 127;
                int G = colors[1] % 3 * 127;
                int B = colors[2] % 3 * 127;
                an.setPixel(j, new Pixel((byte)R, (byte)G, (byte)B));
            }
            an.sendData();
        }
예제 #3
0
 static void Pattern4(Transmitter AN, Pixel P1, Pixel P2, Pixel P3, Pixel P4)
 {
     for (int i = 0; i < 10; i++)
     {
         AN.setPixel(i, P1);
     }
     for (int i = 10; i < 20; i++)
     {
         AN.setPixel(i, P2);
     }
     for (int i = 20; i < 30; i++)
     {
         AN.setPixel(i, P3);
     }
     for (int i = 30; i < 40; i++)
     {
         AN.setPixel(i, P4);
     }
     for (int i = 40; i < 50; i++)
     {
         AN.setPixel(i, new Pixel(255,255,0));
     }
 }
예제 #4
0
 static void Pattern2(Transmitter AN, Pixel P1, Pixel P2)
 {
     for (int i = 75; i < 150; i++)
     {
         for (int j = 0; j < i; j++)
         {
             AN.setPixel(j, P1);
         }
     }
     for (int i = 0; i < 75; i++)
     {
         for (int j = 0; j < i; j++)
         {
             AN.setPixel(j, P2);
         }
     }
     AN.sendData();
 }
예제 #5
0
 static void Pattern1(Transmitter AN, Pixel Pi)
 {
     for (int i = 0; i < 150; i++)
     {
         for (int j = 0; j < i; j++)
         {
             AN.setPixel(j, Pi);
         }
         System.Threading.Thread.Sleep(20);
         AN.sendData();
     }
 }