private void button7_Click(object sender, EventArgs e) { if (serialPort1.IsOpen) { int devID = Convert.ToInt32(textBox_ID.Text); byte[] pac = NuriProtocol.GetPacket(devID, NuriMode.NURI_FACTORY_RESET); serialPort1.Write(pac, 0, pac.Count()); } }
private void button2_Click(object sender, EventArgs e) { if (serialPort1.IsOpen) { int devID = Convert.ToInt32(textBox_ID.Text); double dir = trackBar5.Value; double pos = (Double)trackBar1.Value / 100; double vel = (Double)trackBar2.Value / 100; byte[] pac = NuriProtocol.GetPacket(devID, NuriMode.NURI_SET_POS_VEL, dir, pos, vel); serialPort1.Write(pac, 0, pac.Count()); } }
private void button6_Click(object sender, EventArgs e) { if (serialPort1.IsOpen) { int devID = Convert.ToInt32(textBox_ID.Text); int Kp = Convert.ToInt32(textBox9.Text); int Ki = Convert.ToInt32(textBox8.Text); int Kd = Convert.ToInt32(textBox7.Text); int Imax = Convert.ToInt32(textBox6.Text) * 10; byte[] pac = NuriProtocol.GetPacket(devID, NuriMode.NURI_SET_VEL_PID, Kp, Ki, Kd, Imax); serialPort1.Write(pac, 0, pac.Count()); } }