private void Light_Mode(bool state = false) { if (!Serial_Light.IsOpen) { Serial_Light.Open(); } byte[] a = state ? new byte[] { 0xab, 0xba, 0x03, 0x32, 0x00, 0x01 } : new byte[] { 0xab, 0xba, 0x03, 0x32, 0x00, 0x00 }; Serial_Light.Write(a, 0, a.Length); }
private void trackBar1_Scroll(object sender, EventArgs e) { if (!Serial_Light.IsOpen) { Serial_Light.Open(); } label9.Text = trackBar1.Value.ToString(); byte[] a = { 0xab, 0xba, 0x03, 0x31, 0x00, 0x09 }; a[5] = (byte)trackBar1.Value; Serial_Light.Write(a, 0, a.Length); }