Compass conntected to camera is jerky

I just started using unity and one thing I wanted to try was to connect a unity player camera to the magnetic compass to turn the camera as I turn. While I got the Camera to work but it is extremely jerky, moving with even the slightest movement in degrees. Ive tried a number of different ways to put a filter on the magnetic compass but to no avail. I was wondering if anyone had any advice on the matter. Here is the code I have so far.

#pragma strict
function Start () {
}



function Update () {

transform.localEulerAngles.y = (Input.compass.trueHeading);
}

This is just to help anyone that finds this question when looking for ways to implement camera rotation with the compass. If you are using the gyroscope, the script found here http://forum.unity3d.com/threads/98828-sharing-gyroscope-controlled-camera-on-iPhone-4?highlight=gyro+cam+script works great.
I’m very new to Unity but the following is what I came up with for smoothing the rotation when using the compass. It does adds some lag to the rotation but I will be experimenting with the timeDelta multiplier value to see if I can get better results.

using UnityEngine;
using System.Collections;
#if UNITY_ANDROID
public class CompassTurning : MonoBehaviour {

	// Use this for initialization
	void Start () {
		Input.compass.enabled = true;
	}
	
	// Update is called once per frame
	void Update () {		
			transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(0,Input.compass.magneticHeading, 0),Time.deltaTime*2);
	}
	void OnGUI () {
		GUI.TextArea(new Rect(100,0,100,100),Input.compass.magneticHeading.ToString());
	}
}
#endif

What do you mean bound Time.deltaTime, you mean somthing like this?

function Update () {
var rotation = 0.0; 
var rate =0.0; 
rate = 1/60; 
Input.compass.trueHeading * Time.deltaTime * rate = rotation; 
rotation = transform.localEulerAngles.y; }

A couple bare minimum things you want to do:

  1. any movement done in Update() loops should be bound by Time.deltaTime to make the motion frame rate independent
  2. for camera movement, this can be pretty handy: Unity - Scripting API: Vector3.SmoothDamp. there are other smoothing funtions available as well depending on hour specific needs.