Skip to content
patrickkulling edited this page Sep 30, 2011 · 3 revisions

API Examples - Gyroscope class

Before you starting to use the Gyroscope sensor make sure the device supports this sensor type via:

if (Gyroscope.isSupported())
{
	gyroscope = new Gyroscope();
}

setRequestedUpdateInterval(interval : Number) : void

Sets the frequency in ms in which you wanted to receive status updates. Whenever a status update occurs, the sensor will fires an GyroscopeEvent.UPDATE.

gyroscope.setRequestedUpdateInterval(1000);
gyroscope.addEventListener(GyroscopeEvent.UPDATE, handleGyroscopeUpdate);

getPower() : Number

Retrieve the power in mA used by this sensor while in use.

getMaximumRange() : Number

Retrieve maximum range of the sensor in the sensor's unit. (radians/second)

getResolution() : Number

Retrieve resolution of the sensor in the sensor's unit. (radians/second)

dispose() : void

Call this function if you don't need the class anymore to free your memory.

Clone this wiki locally