This is a demonstration of the Generic Sensor API. This specific example
uses the Accelerometer
sensor to show the acceleration of a device in the X, Y, and Z directions.
The JavaScript code specific to the accelerometer can be found in /public/scripts.js
, here.
The demo will only work on devices that have accelerometers and use Chrome version 67 or higher.
- Sensor Readings: The live sensor reading is displayed in the top of the application in the X, Y, and Z directions.
- Start/Stop Sensor: Stop or start the sensor from reading acceleration values.
- Max Values: Records the maximum value of the sensor in the X, Y, and Z direction (the maximum can be a positive or negative value).
- Reset: Reset the maximum values recorded from the sensor in each X, Y, and Z direction.