Пример #1
0
 private void btnRead_Click(object sender, EventArgs e)
 {
     try
     {
         _communicator.DigitalRead(_pinNumber);
     }
     catch (Exception ex)
     {
         Msgbox.Show(this.ParentForm, ex);
     }
 }
Пример #2
0
 private void btnResetPins_Click(object sender, EventArgs e)
 {
     try
     {
         _commuinicator.ResetPins();
     }
     catch (Exception ex)
     {
         Msgbox.Show(this, ex);
     }
 }
Пример #3
0
 private void btnSetTone_Click(object sender, EventArgs e)
 {
     try
     {
         _communicator.Tone(_pinNumber, toneValueControl1.Frequency, toneValueControl1.Duration);
     }
     catch (Exception ex)
     {
         Msgbox.Show(this.ParentForm, ex);
     }
 }
Пример #4
0
 private void btnSetPWM_Click(object sender, EventArgs e)
 {
     try
     {
         _communicator.AnalogWrite(_pinNumber, pwmValueControl1.Value);
     }
     catch (Exception ex)
     {
         Msgbox.Show(this.ParentForm, ex);
     }
 }
Пример #5
0
 private void btnSetLow_Click(object sender, EventArgs e)
 {
     try
     {
         _communicator.DigitalWrite(_pinNumber, false);
     }
     catch (Exception ex)
     {
         Msgbox.Show(this.ParentForm, ex);
     }
 }
Пример #6
0
        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);
            }
        }
Пример #7
0
 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);
     }
 }