Beispiel #1
0
        private void SweepLeds1()
        {
            // Setup a delay time between each transmit
            const int sleepTime = 20;
            // Setup two byte arrays to hold the RGB of the pixels
            var n = 0;

            while (true)
            {
                CheckForColorChange();
                // Setup the initial four pixels in positions 0, 8, 16 and 24
                _ws2812Strip.Set(0, _color[0], _color[1], _color[2]);
                // Send the first arrangement to the NeoPixel rings
                _ws2812Strip.Transmit();
                // Step through the LEDs.
                for (n = 0; n < _numberOfLeds; n++)
                {
                    _ws2812Strip.Rotate(true);
                    _ws2812Strip.Transmit();
                    Thread.Sleep(sleepTime);
                }
                // Do this forever...
            }
        }
Beispiel #2
0
 /// <summary>
 /// Sets the color of the specified pixel on the <see cref="StarBoard"/>, based on RGB values.
 /// </summary>
 /// <param name="pixelNum">The number of the pixel to set. Must be from 1 to 13.</param>
 /// <param name="R">Byte value containing the Red portion of the color.</param>
 /// <param name="G">Byte value containing the Green portion of the color.</param>
 /// <param name="B">Byte value containing the Blue portion of the color.</param>
 public void SetPixel(int pixelNum, byte R, byte G, byte B)
 {
     MyWS2811Strip.Set(pixelNum - 1, R, G, B);
     MyWS2811Strip.Transmit();
 }
Beispiel #3
0
 // set up LED arrangement functions:
 void setCenterLED(byte red, byte green, byte blue, bool clear = false)
 {
     if (clear)
     {
         MyWS2811Strip.Clear();
     }
     MyWS2811Strip.Set(2, red, green, blue);
     MyWS2811Strip.Transmit();
 }