User Tools

Site Tools


built_in:sensors

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
built_in:sensors [2015/07/07 09:53]
octazid new methods
built_in:sensors [2018/01/03 10:23] (current)
Line 1: Line 1:
 ====== Sensors ====== ====== Sensors ======
  
-//(Information and examples taken from the DroidScript documentation)//+//(Information and examples taken from the DroidScript documentation). Information provided by Nick Weber//
  
 ===== Description ===== ===== Description =====
Line 7: Line 7:
 <code>sns = app.CreateSensor( type, options );</code> <code>sns = app.CreateSensor( type, options );</code>
 Types available are:  Types available are: 
-  * **"Accelerometer"** +  * **Accelerometer** 
-  * **"MagneticField"** +  * **MagneticField** 
-  * **"Orientation"** +  * **Orientation** 
-  * **"Light"** +  * **Light** 
-  * **"Proximity"**+  * **Proximity** 
 +  * **Temperature** 
 +  * **GameRotation** 
 +  * **GeomagneticRotation** 
 +  * **Gravity** 
 +  * **Gyroscope** 
 +  * **HeartRate** 
 +  * **Acceleration** 
 +  * **Pressure** 
 +  * **Humidity** 
 +  * **Rotation** 
 +  * **Motion** 
 +  * **StepCounter** 
 +  * **StepDetector** 
 + 
 +Try **sns.GetNames()** which lists all the sensor information. You can probably scan for certain keywords. 
 + 
 +You can also use a sensor id number instead of the name (just in case a future sensor is added).
  
 You can use the **SetOnChange** function of the Sensor to set the name of a function you want to be called when a the changes occur. You can use the **SetOnChange** function of the Sensor to set the name of a function you want to be called when a the changes occur.
Line 55: Line 72:
 { {
   txt.SetText( "x="+x + "\n y="+y + "\n z="+z );   txt.SetText( "x="+x + "\n y="+y + "\n z="+z );
 +}
 </code> | </code> |
 |Orientation | <code javascript>function OnStart() |Orientation | <code javascript>function OnStart()
built_in/sensors.1436262799.txt.gz · Last modified: 2015/07/07 17:53 (external edit)