public Form1() { InitializeComponent(); this.usbToolStripStatusLabel.Text = "RGB Bargraph Device Detached"; // Serial stuff. try { //serSerialPort.PortName = "COM10"; serSerialPort.Open(); serAttach = true; this.usbToolStripStatusLabel.Text = "Serial port device attached."; } catch (Exception exe) { //MessageBox.Show("ERROR: " + exe); serAttach = false; this.usbToolStripStatusLabel.Text = "Serial port device not found..."; } // Initialise the status strip text //this.usbToolStripStatusLabel.Text = "RGB Bargraph Device Detached"; // Create the USB reference device object (passing VID and PID) theRgbBargraphDevice = new rgbBargraphDevice(0x04D8, 0x0100); // Register for device change notifications theRgbBargraphDevice.registerForDeviceNotifications(this.Handle); // Add a listener for usb events theRgbBargraphDevice.usbEvent += new rgbBargraphDevice.usbEventsHandler(usbEvent_receiver); // Perform an initial search for the target device theRgbBargraphDevice.findTargetDevice(); // Initialise the core audio API MMDeviceEnumerator devEnum = new MMDeviceEnumerator(); defaultDevice = devEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia); // Set the starting value for the LED fade off speed theRgbBargraphDevice.setLedFadeOffSpeed((int)ledFadeOffSpeedTrackBar.Value); }