예제 #1
0
 private void buttonDisconnect_Click(object sender, EventArgs e)
 {
     if (roboClaw.IsOpen())
     {
         myTimer.Stop();                 // Stop the timer to stop the encoder display updates
         roboClaw.Close();               // Close the RoboClaw interface
         labelRoboClawModel.Text  = " "; // Clear the RoboClaw device model number display
         buttonStop.Enabled       = false;
         buttonGoForward.Enabled  = false;
         buttonGoReverse.Enabled  = false;
         buttonGoToZero.Enabled   = false;
         buttonConnect.Enabled    = true;
         buttonDisconnect.Enabled = false;
     }
 }
예제 #2
0
 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;
     }
 }
예제 #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            var devices  = SerialPort.GetDevices();
            var deviceId = devices.First().DeviceID;

            var roboClaw = new Roboclaw("COM3", 38400, 0x80);

            var test = roboClaw.Open();

            roboClaw.GetLogicVoltage(ref voltage);

            Console.WriteLine($"Logic voltage: {voltage}");


            //roboClaw.ST_M1Forward(100);
            //Thread.Sleep(5000);
            //roboClaw.ST_M1Backward(100);
            //Thread.Sleep(3000);
            //roboClaw.ST_M1Forward(0);

            //Thread.Sleep(1000);

            roboClaw.ST_MixedForward(127);
            Thread.Sleep(10000);
            roboClaw.ST_MixedBackward(127);
            Thread.Sleep(2000);
            roboClaw.ST_MixedBackward(0);


            roboClaw.Close();

            Console.WriteLine("found devices:");

            foreach (var device in devices)
            {
                Console.WriteLine($"{device.Description}");
            }

            Console.WriteLine("Press any key to close...");
            Console.ReadKey();
        }