summaryrefslogtreecommitdiffstatshomepage
path: root/docs/library/pyb.Accel.rst
blob: fd96ec35f95fcce488906f606b8e8030c618616e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
class Accel -- accelerometer control
====================================

Accel is an object that controls the accelerometer.  Example usage::

    accel = pyb.Accel()
    for i in range(10):
        print(accel.x(), accel.y(), accel.z())

Raw values are between -32 and 31.


Constructors
------------

.. class:: pyb.Accel()

   Create and return an accelerometer object.
   
Methods
-------

.. method:: accel.filtered_xyz()

   Get a 3-tuple of filtered x, y and z values.

   Implementation note: this method is currently implemented as taking the
   sum of 4 samples, sampled from the 3 previous calls to this function along
   with the sample from the current call.  Returned values are therefore 4
   times the size of what they would be from the raw x(), y() and z() calls.

.. method:: accel.tilt()

   Get the tilt register.

.. method:: accel.x()

   Get the x-axis value.

.. method:: accel.y()

   Get the y-axis value.

.. method:: accel.z()

   Get the z-axis value.