Ejemplo n.º 1
0
        private void CmdTest_Click(object sender, EventArgs e)
        {
            ArduinoComms m_serial = new ArduinoComms(this.cmbComm.Text);

            for (int i = 0; i < 2; i++)
            {
                int result = m_serial.SendCommand((byte)199, 0);
                if (result == 33)
                {
                    MessageBox.Show("Connection Test OK");
                    break;
                }
                else if (result == 254)
                {
                    if (i == 0)
                    {
                        System.Threading.Thread.Sleep(500);
                    }
                    else
                    {
                        MessageBox.Show("Connection Test Timed Out");
                    }
                }
                else
                {
                    MessageBox.Show("connection Test Failed");
                }
            }
            m_serial.Dispose();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sends a command to the dome to begin slewing in a clockwise direction. This slew command can be stopped with the slew_Stop() command
        /// </summary>
        public void Slew_CW()
        {
            WriteToLog(DateTime.Now.ToString() + ": Application >> Driver: Start Manual CW slew", 2);
            int response = serial_port.SendCommand(ARD_SLEW_START_CW, 0);

            WriteToLog(DateTime.Now.ToString() + ": Driver >> Arduino: ARD_SLEW_START_CW", 2);
            if (response != 33)
            {
                WriteToLog(DateTime.Now.ToString() + ": Invalid response received from the Arduino", 2);
                throw new ASCOM.InvalidOperationException("Invalid response received from the Arduino");
            }
            else
            {
                WriteToLog(DateTime.Now.ToString() + ": Arduino >> Driver: Ok (33) response received", 2);
            }
        }