//Not a real factory yet; maybe adding that later /// <summary> /// Initializes a six axis robot, a serial port and wires them together. /// </summary> /// <param name="comPortName">Name of the serial port used for communication with the hardware.</param> /// <returns>Preconfigured robot, with robot and serial port ready for use.</returns> public static PreconfiguredRobot PreconfigureRobot(string comPortName) { var robot = SixAxisMirobot.CreateNew(); var telegramPort = new SerialConnection(comPortName); robot.AttachConnection(telegramPort); telegramPort.AttachRobot(robot); telegramPort.Connect(); return(new PreconfiguredRobot(robot, telegramPort)); }
static void Main(string[] args) { Console.WriteLine("main: connecting..."); SerialConnection connection = new SerialConnection("COM3"); if (connection.Connect()) { Console.WriteLine("main: connected"); while (connection.Connected()) { Thread.Sleep(1000); Console.WriteLine("main: serial read..."); } Console.WriteLine("port: disconnected"); } }
public void Connect(string port) { Connection.Connect(port); }