Gyroscope Controls for Android?

I’m just finished the rolling ball tutorial in the getting started guides:

I wanted to run it on my android device. I thought I’d try to use the gyroscope to control the ball motion, but I can’t seem to find any good examples of this in code. Could anyone talk me through how that would go?

right now what I ahve looks like this:

void doMovement() {
	float moveHorizontal;
	float moveVertical;
	if(Input.gyro.enabled) {
		Gyroscope gyro = Input.gyro;
		moveHorizontal = gyro.gravity.x;
		moveVertical = gyro.gravity.y;
	} else {
		moveHorizontal = Input.GetAxis ("Horizontal");
		moveVertical = Input.GetAxis ("Vertical");
	Vector3 movement = new Vector3(moveHorizontal,0.0f,moveVertical);
	rigidbody.AddForce (movement*speed*Time.deltaTime);


But I don’t really understand how to debug Unity on android, and I can’t really tell whats happening (or if this is even the right way to approach the problem).

Do you mean the Accelerometer?

this is the code I’ve used

void FixedUpdate() 
	Input.gyro.enabled = true;
	float initialOrientationX = Input.gyro.rotationRateUnbiased.x;
	float initialOrientationY = Input.gyro.rotationRateUnbiased.y;

	rb.AddForce (initialOrientationY * speed, 0.0f , -initialOrientationX * speed);

This code isn’t perfect, but it’s working, and you get the idea about how it’s done.