sensorOpen()

Opens the given sensor.

Synopsis

int sensorOpen(string type);

Parameters

Parameter Description
type

The sensor type to be addressed. It can be one of:

  • Accelerometer
  • Altimeter
  • AmbientLightSensor
  • AmbientTemperatureSensor
  • Compass
  • Gyroscope
  • HolsterSensor
  • IRProximitySensor
  • LightSensor
  • Magnetometer
  • OrientationSensor
  • PressureSensor
  • ProximitySensor
  • RotationSensor
  • TapSensor
  • TiltSensor

Return Value

Returns an ID (>=0) which must be used to read or close the sensor. In case of an error -1 is returned.

Errors

Invalid sensor type

Description

The sensor of the given type is opened. The returned index is used to address this sensor.

Assignment

Mobile UI control functions

Availability

UI

See also

sensorClose(), sensorTypes()