private void btnRead_Click(object sender, EventArgs e) { try { _communicator.DigitalRead(_pinNumber); } catch (Exception ex) { Msgbox.Show(this.ParentForm, ex); } }
private void btnResetPins_Click(object sender, EventArgs e) { try { _commuinicator.ResetPins(); } catch (Exception ex) { Msgbox.Show(this, ex); } }
private void btnSetTone_Click(object sender, EventArgs e) { try { _communicator.Tone(_pinNumber, toneValueControl1.Frequency, toneValueControl1.Duration); } catch (Exception ex) { Msgbox.Show(this.ParentForm, ex); } }
private void btnSetPWM_Click(object sender, EventArgs e) { try { _communicator.AnalogWrite(_pinNumber, pwmValueControl1.Value); } catch (Exception ex) { Msgbox.Show(this.ParentForm, ex); } }
private void btnSetLow_Click(object sender, EventArgs e) { try { _communicator.DigitalWrite(_pinNumber, false); } catch (Exception ex) { Msgbox.Show(this.ParentForm, ex); } }
private void Form1_Load(object sender, EventArgs e) { try { pnlButtons.BackColor = Program.BackgroundColor; tabPageMain.BackColor = grpAnalogPins.BackColor = grpDigitalPins.BackColor = Program.BackgroundColor; LoadPorts(); EnableDisableControls(); } catch (Exception ex) { Msgbox.Show(this, ex); } }
private void btnSerialConnectDisconnect_Click(object sender, EventArgs e) { try { if (_commuinicator == null) { int firstByteTimeout = Convert.ToInt32(numResponseTimeoutFirstByte.Value); int lastByteTimeout = Convert.ToInt32(numResponseTimeoutSubsequentBytes.Value); Communicator = new ArduinoCommunicator((string)cmbSerialPort.SelectedItem, firstByteTimeout, lastByteTimeout); } else { Communicator = null; } } catch (Exception ex) { Msgbox.Show(this, ex); } }