Example #1
0
        /// <summary>
        /// Sets the specified colors to blink at every half-second interval.
        /// </summary>
        /// <param name="colors">The colors.</param>
        public void Blink(LightStackColor colors)
        {
            if (colors.HasFlag(LightStackColor.Red))
            {
                _steady &= ~LightStackColor.Red;
            }
            if (colors.HasFlag(LightStackColor.Yellow))
            {
                _steady &= ~LightStackColor.Yellow;
            }
            if (colors.HasFlag(LightStackColor.Green))
            {
                _steady &= ~LightStackColor.Green;
            }
            if (colors.HasFlag(LightStackColor.Blue))
            {
                _steady &= ~LightStackColor.Blue;
            }

            _blinking |= colors;
        }
Example #2
0
        private void Set(LightStackColor colors)
        {
            int[] values = new int[4];

            if (colors.HasFlag(LightStackColor.Red))
            {
                values[0] = 1;
            }
            if (colors.HasFlag(LightStackColor.Yellow))
            {
                values[1] = 1;
            }
            if (colors.HasFlag(LightStackColor.Green))
            {
                values[2] = 1;
            }
            if (colors.HasFlag(LightStackColor.Blue))
            {
                values[3] = 1;
            }

            _bits.SetValues(values);
        }