Hi there,
I'm using the System.IO.Ports and with the SerialPort I can rotate a cube with an arduino and potensiometer, but when I was Building and Run the project with Xcode doesn't work at all.
Is anyone know how it works the SerialPort when you want to Build and Run with iOS and Xcode?
My code on script for cube is:
using UnityEngine;
using System.Collections;
using System.IO.Ports;
public class Rotator : MonoBehaviour {
SerialPort sp = new SerialPort("/dev/cu.usbmodemFA131", 9600);
// Update is called once per frame
void Update ()
{
if (!sp.IsOpen)
sp.Open ();
float rotation = float.Parse (sp.ReadLine ());
transform.localEulerAngles = new Vector3 (0, rotation, 0);
//transform.localPosition = new Vector3 (rotation, 0, 0);
}
}
↧