sensorSet()

Sets some properties of the sensor.

Synopsis

int sensorSet(int sensor, string valueName, <any> value);

Parameters

Parameter Description
sensor Index of the sensor.
valueName Name of the value that will beset, it depends on the respective sensor. For possible Values, see the table below. All sensors have the option "alwaysOn" (bool).
value Anytype vector, in which the reading is saved.

Sensor Type (valueName) Data type Description
All sensors
alwaysOn bool Defines if the sensor should be running when the screen is off.
Magnetometer
returnGeoValues bool

Defines if geomagnetic values should be returned.

  • TRUE: geomagnetic flux density

  • FALSE: raw magnetic flux density

The attribute must be set before start() is called.

TiltSensor
calibrate void Calibrates the tilt sensor. Uses the current tilt angles as 0.

Return Value

Returns -1 if an error occurs and 0 if the function was executed successfully.

Description

Depending on the given sensor type and options, this function sets the sensor options.

Assignment

Mobile UI control functions

Availability

UI

See also

sensorTypes(), sensorOpen(), sensorStart()