C# 用C语言编程实现微光三维传感器
我目前正在启动一个Unity项目,它使用来自Shimmer Sensor的一些传感器。 我无法正确启动我的项目,因为我没有足够的关于他们的C API的文档 所以我想找一个人,他可以分享一个用这种传感器制作的项目,至少是初始化部分和连接 我的代码:C# 用C语言编程实现微光三维传感器,c#,unity3d,C#,Unity3d,我目前正在启动一个Unity项目,它使用来自Shimmer Sensor的一些传感器。 我无法正确启动我的项目,因为我没有足够的关于他们的C API的文档 所以我想找一个人,他可以分享一个用这种传感器制作的项目,至少是初始化部分和连接 我的代码: Shimmer Shim = new Shimmer ("Shimmer3-8615","COM6");//Initialise the sensor for the connection ObjectCluster Test = new Object
Shimmer Shim = new Shimmer ("Shimmer3-8615","COM6");//Initialise the sensor for the connection
ObjectCluster Test = new ObjectCluster ("COM6","Shimmer3-8615");//Contain the Data from the sensor
public float speed;
void Awake ()//Launch when the programme start
{
Shim.Connect ();//Connect the object to the sensor with bluetooth
}
void FixedUpdate ()//Start whenever he receive data
{
float movehorizontal;
float movevertical;
movehorizontal = float.Parse((Test.GetData("Low Noise Accelerometer X", "RAW")).GetData().ToString());
movevertical = float.Parse((Test.GetData("Low Noise Accelerometer Y", "RAW")).GetData().ToString());//Input.GetAxis ("Vertical")
float up = float.Parse((Test.GetData("Low Noise Accelerometer Z", "RAW")).GetData().ToString());//0.0f
Vector3 mouvement = new Vector3 (movehorizontal,up,movevertical);
rigidbody.AddForce (mouvement * speed *Time.deltaTime);
}
当.connect自身执行时,我得到一个空对象异常。
通过COM端口6上的蓝牙进行连接