Пример #1
0
 static void SetColorForIndices(HeroPixel pixelStrip, uint aColor, uint[] indices)
 {
     foreach (uint index in indices)
     {
         pixelStrip.setColor(aColor, index, 1);
     }
 }
Пример #2
0
        private static void ConfigureBodyLightColors()
        {
            const uint kNumOfNeoPixels = 30;
            HeroPixel  pixelStrip      = new HeroPixel(HeroPixel.OFF, kNumOfNeoPixels);

            pixelStrip.setStripColor(HeroPixel.WHITE); // Set default color for entire strip

            uint[] blueIndices   = { 0, 5, 3 };        // Pixel indices that should be blue
            uint[] redIndices    = { 1, 6, 4 };        // Pixel indices that should be red
            uint[] yellowIndices = { 2, 7, 5 };        // Pixel indices that should be yellow

            SetColorForIndices(pixelStrip, HeroPixel.BLUE, blueIndices);
            SetColorForIndices(pixelStrip, HeroPixel.RED, redIndices);
            SetColorForIndices(pixelStrip, HeroPixel.YELLOW, yellowIndices);

            pixelStrip.writeOutput();

            // TODO: Add ability to schedule lights to blink on an interval, etc.
        }