/// <summary> /// Sets the brightness of the orb /// </summary> /// <remarks> /// My orb doesn't seem to respond to this commmand. Let me know if you have any luck /// with it ([email protected]) /// </remarks> /// <param name="brightness">OrbBrightness value</param> /// <exception cref="ObjectDisposedException">Thrown if the OrbSerialController has been disposed</exception> public void SetBrightness(OrbBrightness brightness) { if (_disposed) { throw new ObjectDisposedException("OrbSerialController"); } // always make sure that pager control is disabled _serialPort.Write("~GT"); // construct and send the brightness color message byte[] message = new byte[] { (byte)'~', (byte)'R', (byte)brightness }; _serialPort.Write(message, 0, message.Length); }
private void comboBoxBrightness_SelectedIndexChanged(object sender, EventArgs e) { if (comboBoxBrightness.SelectedItem is string) { try { OrbBrightness brightness = (OrbBrightness)Enum.Parse(typeof(OrbBrightness), comboBoxBrightness.SelectedItem as string); _orbSerial.SetBrightness(brightness); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Ambient Orb Tester - Failed to set brightness", MessageBoxButtons.OK, MessageBoxIcon.Hand); } } }