Пример #1
0
    // Use this for initialization
    void Start()
    {
        //stringComparer = StringComparer.OrdinalIgnoreCase;
        readThread = new Thread(Read);

        // Create a new SerialPort object with default settings.
        _serialPort = new SerialPort();

        // Allow the user to set the appropriate properties.
        _serialPort.PortName  = _serialPort.PortName;
        _serialPort.BaudRate  = 115200;
        _serialPort.Parity    = _serialPort.Parity;
        _serialPort.DataBits  = _serialPort.DataBits;
        _serialPort.StopBits  = _serialPort.StopBits;
        _serialPort.Handshake = _serialPort.Handshake;

        _serialPort.NewLine = "\r\n";

        // Set the read/write timeouts
        _serialPort.ReadTimeout  = 500;
        _serialPort.WriteTimeout = 500;

        _serialPort.Open();
        _continue = true;

        readThread.Start();
        _connected = true;

        //movementController = GameObject.FindGameObjectWithTag ("MovementController");
        //accelerationController = GameObject.FindGameObjectWithTag ("AccelerationController");

        robotArm = GameObject.Find("Robot Arm").GetComponent <RobotArmControl>();

//		while (true) {
//			// Start read coroutine
//			StartCoroutine
//			(
//				AsynchronousReadFromArduino
//				(   (string s) => Debug.Log(s),     // Callback
//					() => Debug.LogError("Error!"), // Error callback
//					10f                             // Timeout (seconds)
//				)
//			);
//		}
    }
Пример #2
0
 // Use this for initialization
 void Start()
 {
     robotArm       = GameObject.Find("Epson5S");
     robotArmScript = robotArm.GetComponent <RobotArmControl>();
     preAngle       = (float)robotArmScript.theta2;
 }
Пример #3
0
 // Use this for initialization
 void Start()
 {
     returnPosition = transform.position;
     rb             = GetComponent <Rigidbody>();
     RobotArm       = GetComponentInParent <RobotArmControl>();
 }
Пример #4
0
 // Use this for initialization
 void Start()
 {
     robotArmController = GetComponentInParent <RobotArmControl> ();
 }
 // Use this for initialization
 void Start()
 {
     robotArm       = GameObject.Find("Epson5S");
     robotArmScript = robotArm.GetComponent <RobotArmControl>();
 }