Example #1
0
 /// <summary>
 /// stop情况下电机off
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btn_Stop_Click(object sender, EventArgs e)
 {
     JohnbeeSerialPort.Send_ComData(1, TopId, (byte)FormSetId.ID_Motor_Stop);
     btn_MotorOn.Text = "MotorOn";
     tb_State.Text    = "OFF";
     JohnbeeSerialPort.Send_ComData(0, TopId, (byte)FormSetId.ID_Motor_State);
 }
Example #2
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (JohnbeeSerialPort.MySerialPort.IsOpen)
     {
         JohnbeeSerialPort.SerialPort_Close();
     }
 }
Example #3
0
 private void btn_MotorOn_Click(object sender, EventArgs e)
 {
     if (btn_MotorOn.Text == "MotorOn")
     {
         btn_MotorOn.Text = "MotorOff";
         tb_State.Text    = "ON";
         JohnbeeSerialPort.Send_ComData(1, TopId, (byte)FormSetId.ID_Motor_State);
         nUD_MaxAmprage.Enabled = false;
         nUD_MaxSpd.Enabled     = false;
         Comb_Mode.Enabled      = false;
         if (Comb_Mode.SelectedIndex == 0)
         {
             nUD_SetDistance.Enabled = true;
         }
         else if (Comb_Mode.SelectedIndex == 1)
         {
             nUD_SetSpd.Enabled = true;
         }
     }
     else
     {
         btn_MotorOn.Text = "MotorOn";
         tb_State.Text    = "OFF";
         JohnbeeSerialPort.Send_ComData(0, TopId, (byte)FormSetId.ID_Motor_State);
         nUD_MaxAmprage.Enabled  = true;
         nUD_MaxSpd.Enabled      = true;
         Comb_Mode.Enabled       = true;
         nUD_SetDistance.Enabled = false;
         nUD_SetSpd.Enabled      = false;
     }
 }
Example #4
0
 private void Comb_Bps_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (JohnbeeSerialPort.SerialPort_Close() == 0)
     {
         btn_open.Text = "Open";
         JohnbeeSerialPort.Set_PortBps(Comb_Bps.Text);
     }
 }
Example #5
0
 private void btn_Refresh_Click(object sender, EventArgs e)
 {
     Comb_Port.Items.Clear();
     JohnbeeSerialPort.SerialPort_Search();
     string[] coms = JohnbeeSerialPort.SerialPort_Search();
     foreach (string com in coms)
     {
         Comb_Port.Items.Add(com);
         Comb_Port.Text = com;
     }
 }
Example #6
0
 private void Form1_Load(object sender, EventArgs e)
 {
     Comb_Bps.Items.Add("9600");
     Comb_Bps.Items.Add("115200");
     Comb_Bps.Text = "115200";
     string[] coms = JohnbeeSerialPort.SerialPort_Search();
     foreach (string com in coms)
     {
         Comb_Port.Items.Add(com);
         Comb_Port.Text = com;
     }
 }
Example #7
0
 private void FormSet_Load(object sender, EventArgs e)
 {
     JohnbeeSerialPort.ComDataChangeEvent += Reflash_Form;
     //先off电机
     JohnbeeSerialPort.Send_ComData(0, TopId, (byte)FormSetId.ID_Motor_State);
     nUD_SetDistance.Enabled = false;
     nUD_SetSpd.Enabled      = false;
     //richTextBox1.Enabled = false;
     MyRecongizer.SpeechRecognized += MyRecongizer_SpeechRecognized;
     MotorGrammar.Add(MyCallHelpGrammar);
     MotorGrammar.Add(MySetParamGrammar);
     MotorGrammar.Add(MyMotorOperatingGrammar);
     foreach (TopGrammar gra in MotorGrammar)
     {
         MyRecongizer.LoadGrammar(gra.RootGrammar);
         richTextBox1.Text += gra.RootGrammar_ShowPhrase + "\n";
     }
     MyRecongizer.SetInputToDefaultAudioDevice();         //设置输入为麦克风
     MyRecongizer.RecognizeAsync(RecognizeMode.Multiple); //异步执行识别
 }
Example #8
0
 private void btn_open_Click(object sender, EventArgs e)
 {
     if (btn_open.Text == "Open")
     {
         if (JohnbeeSerialPort.SerialPort_Open() == 0)
         {
             btn_open.Text       = "Colse";
             Comb_Bps.Enabled    = false;
             Comb_Port.Enabled   = false;
             btn_Refresh.Enabled = false;
         }
     }
     else if (btn_open.Text == "Colse")
     {
         if (JohnbeeSerialPort.SerialPort_Close() == 0)
         {
             btn_open.Text       = "Open";
             Comb_Bps.Enabled    = true;
             Comb_Port.Enabled   = true;
             btn_Refresh.Enabled = true;
         }
     }
 }
Example #9
0
 private void Comb_Mode_SelectedIndexChanged(object sender, EventArgs e)
 {
     JohnbeeSerialPort.Send_ComData(Comb_Mode.SelectedIndex, TopId, (byte)FormSetId.ID_Motor_Mode);
 }
Example #10
0
 private void numericUpDown_Loc_Kd3_ValueChanged(object sender, EventArgs e)
 {
     JohnbeeSerialPort.Send_ComData(numericUpDown_Loc_Kd3.Value, TopId, (byte)(byte)(byte)FormPIDId.ID_Loc_Kd3);
 }
Example #11
0
 private void numericUpDown_Psi_Ki2_ValueChanged(object sender, EventArgs e)
 {
     JohnbeeSerialPort.Send_ComData(numericUpDown_Psi_Ki2.Value, TopId, (byte)FormPIDId.ID_Psi_Ki2);
 }