Información sobre el acelerómetro:
Non-visible component that can detect shaking and measure acceleration approximately in three dimensions using SI units (m/s2).
The components are:
- xAccel: 0 when the phone is at rest on a flat surface, positive when the phone is tilted to the right (i.e., its left side is raised), and negative when the phone is tilted to the left (i.e., its right size is raised).
- yAccel: 0 when the phone is at rest on a flat surface, positive when its bottom is raised, and negative when its top is raised.
- zAccel: Equal to -9.8 (earth’s gravity in meters per second per second when the device is at rest parallel to the ground with the display facing up, 0 when perpendicular to the ground, and +9.8 when facing down. The value can also be affected by accelerating it with or against gravity.
- Available: Returns whether the AccelerometerSensor hardware is available on the device.
- Enabled: Specifies whether the sensor should generate events. If true, the sensor will generate events. Otherwise, no events are generated even if the device is accelerated or shaken.
- LegacyMode: Prior to the release that added this property the AccelerometerSensor component passed through sensor values directly as received from the Android system. However these values do not compensate for tablets that default to Landscape mode, requiring the MIT App Inventor programmer to compensate. However compensating would result in incorrect results in Portrait mode devices such as phones. We now detect Landscape mode tablets and perform the compensation. However if your project is already compensating for the change, you will now get incorrect results. Although our preferred solution is for you to update your project, you can also just set this property to «true» and our compensation code will be deactivated. Note: We recommend that you update your project as we may remove this property in a future release.
- MinimumInterval: Specifies the minimum interval required between back-to-back Shaking events, in milliseconds. Once the phone starts being shaken, all further Shaking events will be ignored until the interval has elapsed.
- Sensitivity: Specifies the sensitivity of the accelerometer. Valid values are: 1 (weak), 2 (moderate), and 3 (strong).
- XAccel: Returns the acceleration in the X-dimension in SI units (m/s²). The sensor must be enabled to return meaningful values.
- YAccel: Returns the acceleration in the Y-dimension in SI units (m/s²). The sensor must be enabled to return meaningful values.
- ZAccel: Returns the acceleration in the Z-dimension in SI units (m/s²). The sensor must be enabled to return meaningful values.
- AccelerationChanged(xAccel,yAccel,zAccel): Indicates the acceleration changed in the X, Y, and/or Z dimensions.
- Shaking(): Indicates the device started being shaken or continues to be shaken.