Welcome to myCobot 320 Arm repository
5.Use Cases
Use Cases
SendOneAngle()
x
using System; using System.Threading;
namespace Mycobot.csharp { class Test { static void Main(string[] args) { MyCobot mc = new MyCobot("COM57");//Raspberry Pi robotic arm serial port name: /dev/ttyAMA0 mc.Open(); Thread.Sleep(5000);//After Windows opens the serial port, you need to wait for 5 seconds, and the basic button at the bottom of Windows will restart when it opens the serial port. mc.SendOneAngle(1,20,50); //Move a joint by 20 degrees at a speed of 50 Thread.Sleep(5000); mc.Close(); } } }GetAngles()
x
using System; using System.Threading;
namespace Mycobot.csharp { class Test { static void Main(string[] args) { MyCobot mc = new MyCobot("COM57");//Raspberry Pi robotic arm serial port name: /dev/ttyAMA0 mc.Open(); Thread.Sleep(5000);//After Windows opens the serial port, you need to wait for 5 seconds, and the basic button at the bottom of Windows will restart when it opens the serial port. var recv = mc.GetAngles();//Get angle information foreach (var v in recv) { Console.WriteLine(v); } mc.Close(); } } }SendAngles()
x
using System; using System.Threading;
namespace Mycobot.csharp { class Test { static void Main(string[] args) { MyCobot mc = new MyCobot("COM57");//Raspberry Pi robotic arm serial port name: /dev/ttyAMA0 mc.Open(); Thread.Sleep(5000);//After Windows opens the serial port, you need to wait for 5 seconds, and the basic button at the bottom of Windows will restart when it opens the serial port. mc.SendOneAngle(1,0, 70); Thread.Sleep(100); mc.Close(); } } }GetCoords()
x
using System; using System.Threading;
namespace Mycobot.csharp { class Test { static void Main(string[] args) { MyCobot mc = new MyCobot("COM57");//Raspberry Pi robotic arm serial port name: /dev/ttyAMA0 mc.Open(); Thread.Sleep(5000);//After Windows opens the serial port, you need to wait for 5 seconds, and the basic button at the bottom of Windows will restart when it opens the serial port. var recv = mc.GetCoords(); foreach (var v in recv) { Console.WriteLine(v); } Thread.Sleep(100); mc.Close(); } } }SendCoords()
x
using System; using System.Threading;
namespace Mycobot.csharp { class Test { static void Main(string[] args) { MyCobot mc = new MyCobot("COM57");//Raspberry Pi robotic arm serial port name: /dev/ttyAMA0 mc.Open(); Thread.Sleep(5000);//After Windows opens the serial port, you need to wait for 5 seconds, and the basic button at the bottom of Windows will restart when it opens the serial port. int[] coords = new[] {160, 160, 160, 0, 0, 0}; //Parameter 1: coordinate, 2: speed, 3: mode mc.SendCoords(coords, 90, 1); Thread.Sleep(100); mc.Close(); } } }SendOneCoord()
x
using System; using System.Threading;
namespace Mycobot.csharp { class Test { static void Main(string[] args) { MyCobot mc = new MyCobot("COM57");//Raspberry Pi robotic arm serial port name: /dev/ttyAMA0 mc.Open(); Thread.Sleep(5000);//After Windows opens the serial port, you need to wait for 5 seconds, and the basic button at the bottom of Windows will restart when it opens the serial port. mc.SendOneAngle(1,0, 70); Thread.Sleep(100); mc.Close(); } } }SetDigitalOut()
x
using System; using System.Threading;
namespace Mycobot.csharp { class Test { static void Main(string[] args) { MyCobot mc = new MyCobot("COM57");//Raspberry Pi robotic arm serial port name: /dev/ttyAMA0 mc.Open(); Thread.Sleep(5000);//After Windows opens the serial port, you need to wait for 5 seconds, and the basic button at the bottom of Windows will restart when it opens the serial port. mc.SetDigitalOut(23, 0); Thread.Sleep(100); mc.SetDigitalOut(33, 0); Thread.Sleep(100); mc.Close(); } } }GetDigitalIn()
x
using System; using System.Threading;
namespace Mycobot.csharp { class Test { static void Main(string[] args) { MyCobot mc = new MyCobot("COM57");//Raspberry Pi robotic arm serial port name: /dev/ttyAMA0 mc.Open(); Thread.Sleep(5000);//After Windows opens the serial port, you need to wait for 5 seconds, and the basic button at the bottom of Windows will restart when it opens the serial port. int num = GetDigitalIn(23); mc.Close(); } } }setGripperValue()
x
using System; using System.Threading;
namespace Mycobot.csharp { class Test { static void Main(string[] args) { MyCobot mc = new MyCobot("COM57");//Raspberry Pi robotic arm serial port name: /dev/ttyAMA0 mc.Open(); Thread.Sleep(5000);//After Windows opens the serial port, you need to wait for 5 seconds, and the basic button at the bottom of Windows will restart when it opens the serial port. mc.SetGripperMode(0);//Transparent transmission Thread.Sleep(1000); mc.setGripperValue(0,10) mc.Close(); } } }getGripperValue()
x
using System; using System.Threading;
namespace Mycobot.csharp { class Test { static void Main(string[] args) { MyCobot mc = new MyCobot("COM57");//Raspberry Pi robotic arm serial port name: /dev/ttyAMA0 mc.Open(); Thread.Sleep(5000);//After Windows opens the serial port, you need to wait for 5 seconds, and the basic button at the bottom of Windows will restart when it opens the serial port. mc.SetGripperMode(0);//Transparent transmission Thread.Sleep(1000); int num = mc.getGripperValue(); mc.Close(); } } }SetBasicOut()
x
using System; using System.Threading;
namespace Mycobot.csharp { class Test { static void Main(string[] args) { MyCobot mc = new MyCobot("COM57");//Raspberry Pi robotic arm serial port name: /dev/ttyAMA0 mc.Open(); Thread.Sleep(5000);//After Windows opens the serial port, you need to wait for 5 seconds, and the basic button at the bottom of Windows will restart when it opens the serial port. mc.SetBasicOut(2, 1); Thread.Sleep(100); mc.SetBasicOut(5, 1); Thread.Sleep(100); mc.SetBasicOut(26, 1); Thread.Sleep(100); mc.Close(); } } }GetBasicIn()
x
using System; using System.Threading;
namespace Mycobot.csharp { class Test { static void Main(string[] args) { MyCobot mc = new MyCobot("COM57");//Raspberry Pi robotic arm serial port name: /dev/ttyAMA0 mc.Open(); Thread.Sleep(5000);//After Windows opens the serial port, you need to wait for 5 seconds, and the basic button at the bottom of Windows will restart when it opens the serial port. int num = mc.GetBasicIn(35); mc.Close(); } } }