private void disconnectFromRoboclaw(Roboclaw roboclaw) { Globals.axisController.stopMotors(roboclaw); roboclaw.Close(); Console.WriteLine("is roboclaw open? " + roboclaw.IsOpen()); if (roboclaw.IsOpen() == false) { connectedToRoboClaw = 0; } else { Console.WriteLine("Something went wrong. could not disconnect from roboclaw"); connectedToRoboClaw = 1; } }
private Roboclaw connectToRoboClaw(Roboclaw roboclaw, int baudRate, byte adress, string comport) { roboclaw = new Roboclaw(comport, baudRate, adress); roboclaw.Open(); Console.WriteLine("is roboclaw open? " + roboclaw.IsOpen()); if (roboclaw.IsOpen() == true) { connectedToRoboClaw = 1; } else { Console.WriteLine("Something went wrong. could not connect to roboclaw. is power on?"); connectedToRoboClaw = 0; } return(roboclaw); }
private void buttonConnect_Click(object sender, EventArgs e) { if (!roboClaw.IsOpen()) { roboClaw.Open("AUTO", ref roboClawModel, 128, 38400); // Open the interface to the RoboClaw labelRoboClawModel.Text = roboClawModel; // Display the RoboClaw device model number roboClaw.ResetEncoders(); buttonConnect.Enabled = false; buttonGoForward.Enabled = true; buttonGoReverse.Enabled = true; buttonDisconnect.Enabled = true; } }