コード例 #1
0
ファイル: Program.cs プロジェクト: JoeyJo0/ArtNet-Tools
 static void Pattern3(Transmitter AN, Pixel P1, Pixel P2, int dly)
 {
     int dR = P2.R - P1.R;
     int dG = P2.G - P1.G;
     int dB = P2.B - P1.B;
     Pixel P = P1;
     for (byte i = 0; i < 255; i++)
     {
         P = new Pixel((byte)(P.R + (dR / 255f)), (byte)(P.G + (dG / 255f)), (byte)(P.B + (dB / 255f)));
         AN.setAllPixels(P);
         AN.sendData();
         System.Threading.Thread.Sleep(dly);
     }
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: JoeyJo0/ArtNet-Tools
 static void Main(string[] args)
 {
     Transmitter an = new Transmitter("127.0.0.1", 16454, false, 0);
     //Transmitter AN = new Transmitter("172.31.41.111", 6454, false);
     //Transmitter an = new Transmitter("192.168.42.255", 6454, false, 0);
     Pixel P1 = new Pixel(255,0,0);
     Pixel P2 = new Pixel(0,0,255);
     Console.WriteLine("What uni to send on?");
     string entryuni = Console.ReadLine();
     short universe = Convert.ToInt16(entryuni);
     Console.WriteLine("Modes:");
     Console.WriteLine("0 - Off");
     Console.WriteLine("1 - Scan");
     Console.WriteLine("2 - Police");
     Console.WriteLine("3 - Clock");
     Console.WriteLine("4 - Rainbow");
     Console.WriteLine("5 - Rainbow(Slow)");
     Console.WriteLine("6 - Random Colors");
     Console.WriteLine("7 - Show Address*");
     Console.WriteLine("8 - Strobe");
     Modes mode = Modes.Rainbow;
     int ModeK = Convert.ToInt32(Console.ReadKey().KeyChar.ToString());
     mode = (Modes)ModeK;
     while (true)
     {
         switch (mode)
         {
             case Modes.Off:
                 an.setAllPixels(new Pixel(0, 0, 0));
                 an.sendData();
                 System.Threading.Thread.Sleep(50000);
              break;
             case Modes.Scan:
                 an.setUniverse(universe);
                 Pattern1(an, new Pixel(255, 0, 0));
                 System.Threading.Thread.Sleep(25);
                 Pattern1(an, new Pixel(255, 255, 0));
                 System.Threading.Thread.Sleep(25);
                 Pattern1(an, new Pixel(0, 255, 0));
                 System.Threading.Thread.Sleep(25);
                 Pattern1(an, new Pixel(0, 255, 255));
                 System.Threading.Thread.Sleep(25);
                 Pattern1(an, new Pixel(0, 0, 255));
                 System.Threading.Thread.Sleep(25);
                 Pattern1(an, new Pixel(255, 0, 255));
                 System.Threading.Thread.Sleep(25);
              break;
             case Modes.Police:
                 an.setUniverse(universe);
                 Pattern2(an, P1, P2);
                 System.Threading.Thread.Sleep(500);
                 Pattern2(an, P2, P1);
                 System.Threading.Thread.Sleep(500);
              break;
             case Modes.Clock:
                 an.setUniverse(universe);
                 Clock(an);
                 System.Threading.Thread.Sleep(1000);
              break;
             case Modes.Rainbow:
                 an.setUniverse(universe);
                 Pattern3(an, new Pixel(255, 0, 0), new Pixel(0, 255, 0), 20);
                 Pattern3(an, new Pixel(0, 255, 0), new Pixel(0, 0, 255), 20);
                 Pattern3(an, new Pixel(0, 0, 255), new Pixel(255, 0, 0), 20);
                 System.Threading.Thread.Sleep(100);
              break;
             case Modes.SlowRainbow:
                 an.setUniverse(universe);
                 Pattern3(an, new Pixel(255, 0, 0), new Pixel(0, 255, 0), 300);
                 Pattern3(an, new Pixel(0, 255, 0), new Pixel(0, 0, 255), 300);
                 Pattern3(an, new Pixel(0, 0, 255), new Pixel(255, 0, 0), 300);
                 System.Threading.Thread.Sleep(100);
              break;
             case Modes.Strobe:
                 an.setUniverse(universe);
                 an.setAllPixels(new Pixel(0, 0, 0));
                 an.sendData();
                 System.Threading.Thread.Sleep(100);
                 an.setAllPixels(new Pixel(255, 255, 255));
                 an.sendData();
                 System.Threading.Thread.Sleep(100);
              break;
             default:
                 an.setUniverse(universe);
                 Pattern3(an, new Pixel(255, 0, 0), new Pixel(0, 255, 0), 20);
                 Pattern3(an, new Pixel(0, 255, 0), new Pixel(0, 0, 255), 20);
                 Pattern3(an, new Pixel(0, 0, 255), new Pixel(255, 0, 0), 20);
              break;
             case Modes.ShowAddress:
                  ShowAddress(an);
                  System.Threading.Thread.Sleep(500);
              break;
             case Modes.Random:
                  RandomColor(an);
                  System.Threading.Thread.Sleep(500);
              break;
         }
     }
 }