Skip to content

Commit fa86088

Browse files
authored
Update documentation for WeDo sensors (#171)
1 parent ac2137f commit fa86088

File tree

5 files changed

+63
-1
lines changed

5 files changed

+63
-1
lines changed

docs/buildhat/index.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ power supply. For best results, use the `official Raspberry Pi Build HAT power s
4040
colordistancesensor.rst
4141
distancesensor.rst
4242
forcesensor.rst
43+
light.rst
4344
matrix.rst
45+
motionsensor.rst
4446
motor.rst
4547
motorpair.rst
4648
passivemotor.rst
49+
tiltsensor.rst
4750
hat.rst
48-
light.rst

docs/buildhat/motion.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""Example using motion sensor"""
2+
3+
from time import sleep
4+
5+
from buildhat import MotionSensor
6+
7+
motion = MotionSensor('A')
8+
9+
for _ in range(50):
10+
print(motion.get_distance())
11+
sleep(0.1)

docs/buildhat/motionsensor.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Motion Sensor
2+
=============
3+
4+
|location_link|
5+
6+
.. |location_link| raw:: html
7+
8+
<a href="https://www.bricklink.com/catalogItemInv.asp?S=45304-1" target="_blank">BrickLink item</a>
9+
10+
.. autoclass:: buildhat.MotionSensor
11+
:members:
12+
:inherited-members:
13+
14+
Example
15+
-------
16+
17+
.. literalinclude:: motion.py
18+
19+

docs/buildhat/tilt.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""Example using tilt sensor"""
2+
3+
from time import sleep
4+
5+
from buildhat import TiltSensor
6+
7+
tilt = TiltSensor('A')
8+
9+
for _ in range(50):
10+
print(tilt.get_tilt())
11+
sleep(0.1)

docs/buildhat/tiltsensor.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Tilt Sensor
2+
===========
3+
4+
|location_link|
5+
6+
.. |location_link| raw:: html
7+
8+
<a href="https://www.bricklink.com/catalogItemInv.asp?S=45305-1" target="_blank">BrickLink item</a>
9+
10+
.. autoclass:: buildhat.TiltSensor
11+
:members:
12+
:inherited-members:
13+
14+
Example
15+
-------
16+
17+
.. literalinclude:: tilt.py
18+
19+

0 commit comments

Comments
 (0)