self.machine.accelerometers.*¶
-
class
mpf.devices.accelerometer.
Accelerometer
(self_inner, *args, **kwargs)¶ Bases:
mpf.core.system_wide_device.SystemWideDevice
Implement an accelerometer.
Args: Same as the Device parent class
Accessing accelerometers in code
The device collection which contains the accelerometers in your machine is available via
self.machine.accelerometers
. For example, to access one called "foo", you would useself.machine.accelerometers.foo
. You can also access accelerometers in dictionary form, e.g.self.machine.accelerometers['foo']
.You can also get devices by tag or hardware number. See the DeviceCollection documentation for details.
Methods & Attributes
Accelerometers have the following methods & attributes available. Note that methods & attributes inherited from base classes are not included here.
-
get_level_xyz
()¶ Return current 3D level.
-
get_level_xz
()¶ Return current 2D x/z level.
-
get_level_yz
()¶ Return current 2D y/z level.
-
update_acceleration
(x, y, z)¶ Calculate acceleration based on readings from hardware.
-