Original Author Paul Laughton, 2011
Page 197
De Re BASIC!
This table gives a general idea of what the rate values mean. The delay values are only "suggestions" to
the sensors, which may alter the real delays, and do not apply to all sensors. Faster settings use more
battery.
Value
Name
Typical Delay
Typical Usage
3
Normal
200 ms
Default: suitable for screen orientation changes
2
UI
60 ms
Rate suitable for the user interface
1
Game
20 ms
Rate suitable for game play
0
Fastest
0 ms
Sample as fast as possible
Example:
SENSORS.OPEN 1:1, 3
% Monitor the Acceleration sensor at Game rate
% and the Orientation sensor at Normal rate.
This command must be executed before issuing any Sensors.read commands. You should only open the
sensors that you actually want to read. Each sensor opened increases battery drain and the background
CPU usage.
BASIC! uses the colon character to separate multiple commands on a single line. The use of colon in this
command conflicts with that feature, so you must use caution when using both features together.
If you put any colons on a line after this command, the preprocessor always assumes the colons are part
of the command and not command separators. The Sensors.open command must be either on a line by
itself or placed last on a multi-command line.
Sensors.read sensor_type_nexp, p1_nvar, p2_nvar, p3_nvar
This command returns that latest values from the sensors specified by the "sensor_type" parameters.
The values are returned are placed into the p1, p2 and p3 parameters. The meaning of these parameters
depends upon the sensor being read. Not all sensors return all three parameter values. In those cases,
the unused parameter values will be set to zero. See
of these parameters.
Sensors.close
Closes the previously opened sensors. The sensors' hardware will be turned off preventing battery drain.
Sensors are automatically closed when the program run is stopped via the BACK key or Menu->Stop.
System
The System commands provide for the execution of System commands on non-rooted devices.
The SU commands provide for the execution of Superuser commands on rooted devices. See the Sample
Program, f36_superuser.bas, for an example using these commands.
The App commands provide for sending messages through the Android system to other applications on
your Android device.