diff options
author | Damien George <damien.p.george@gmail.com> | 2014-10-31 01:37:19 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-10-31 01:37:19 +0000 |
commit | 88d3054ac072f9c73b0f3f045c59ba74f6730c1d (patch) | |
tree | 6db7851068908c0640b1ed306d6823871fd3d742 /docs/library/pyb.Accel.rst | |
parent | 7c4445afe104631d5fe8e7401d50f40f205e35b9 (diff) | |
download | micropython-88d3054ac072f9c73b0f3f045c59ba74f6730c1d.tar.gz micropython-88d3054ac072f9c73b0f3f045c59ba74f6730c1d.zip |
docs: Import documentation from source-code inline comments.
The inline docs (prefixed with /// in .c files) have been converted to
RST format and put in the docs subdirectory.
Diffstat (limited to 'docs/library/pyb.Accel.rst')
-rw-r--r-- | docs/library/pyb.Accel.rst | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/docs/library/pyb.Accel.rst b/docs/library/pyb.Accel.rst new file mode 100644 index 0000000000..69340af9f9 --- /dev/null +++ b/docs/library/pyb.Accel.rst @@ -0,0 +1,51 @@ +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. + + Note: if you read accelerometer values immediately after creating this object + you will get 0. It takes around 20ms for the first sample to be ready, so, + unless you have some other code between creating this object and reading its + values, you should put a ``pyb.delay(20)`` after creating it. For example:: + + accel = pyb.Accel() + pyb.delay(20) + print(accel.x()) + + +Methods +------- + +.. method:: accel.filtered_xyz() + + Get a 3-tuple of filtered x, y and z values. + +.. 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. |