how to connect a Phidget Spatial 0/0/3 to Unity?

I am not a very experienced coder. I am using c# in Unity. I have difficulty connecting my Phitget Spatial ingame.

I would love to see an good example.It would safe me a lot of time. I found some Unity examples…but in those examples they use different Sensors.

At Phidget they suggest to use coding by using their events.

This are the links I am working with atm.

Phidget Unity Wiki

C# Maual Phidget

Phidget Api Maual

Well I kind of found a solution already. To safe others some time. Here is what i did.
Make a Plugins folder in your project.

In stall the Phidget setup software.

Copy the Phidget21.NET file in the Plugins folder you made. You can download the Phidget21.Net here.

You can use following code. Ofcourse this works only for the Phidget Spatial 0/0/3. Tho it should be very easy to set up othere sensors.

using System.Collections; 
using Phidgets; 
using Phidgets.Events; 

public class phidget : MonoBehaviour { 
	InterfaceKit motionFloor; 
	// Use this for initialization 

	public GameObject objectToManipulate;
	private Quaternion newVector;
	private Spatial spatial;
	public float rotationX;
	public float rotationZ;
	public Quaternion newQuat;

	public float zSensitivity = 0.75f;
	public float xSensitivity = 0.25f;

	void Start () { 
		spatial = new Spatial();
		newQuat = objectToManipulate.transform.rotation;
		spatial.SpatialData += new SpatialDataEventHandler(spatial_SpatialData);;
		spatial.DataRate = 144;
	void Update () { 
		Debug.Log("RotationX = " + rotationX + " RotationZ =" + rotationZ);

		newQuat.x = rotationX;
		newQuat.z = rotationZ;
		objectToManipulate.transform.rotation = newQuat;

	public void spatial_SpatialData(object sender, SpatialDataEventArgs e)

		rotationX = (float) e.spatialData[0].Acceleration[0] * xSensitivity;
		rotationZ = (float) e.spatialData[0].Acceleration[1] * zSensitivity;


	public void OnApplicationQuit ()



Don’t use any other programs which are using the Phidget at the same time as your Unity project. The Phidget will be reserved by that program and won’t work.