Пример #1
0
        private void colorPicker_HSVColorChanged(object sender, HSVColorChangedEventArgs e)
        {
            Console.WriteLine("Color Changed: " + e);
            HSVColorPicker.HSVparam hsvColours = colorPicker.HSV;
            // h: 0 - 6, s: 0 - 1, v: 0 - 1\
            // Calculate and send H, S, V values
            int hue = (int)Math.Round((Math.Max(0, Math.Min(1, (hsvColours.H / 6))) * 255));
            int sat = (int)Math.Round(hsvColours.S * 255);
            int val = (int)Math.Round(hsvColours.V * 255);

            sendToArduino(new byte[] { 4, (byte)hue, (byte)sat, (byte)val });
        }
Пример #2
0
 public HSVColorChangedEventArgs(HSVColorPicker.HSVparam hsv)
 {
     this.hsv = hsv;
 }