diff --git a/docs/buildhat/index.rst b/docs/buildhat/index.rst index 9ac86b4..91b48b0 100644 --- a/docs/buildhat/index.rst +++ b/docs/buildhat/index.rst @@ -40,9 +40,11 @@ power supply. For best results, use the `official Raspberry Pi Build HAT power s colordistancesensor.rst distancesensor.rst forcesensor.rst + light.rst matrix.rst + motionsensor.rst motor.rst motorpair.rst passivemotor.rst + tiltsensor.rst hat.rst - light.rst diff --git a/docs/buildhat/motion.py b/docs/buildhat/motion.py new file mode 100755 index 0000000..cf48829 --- /dev/null +++ b/docs/buildhat/motion.py @@ -0,0 +1,11 @@ +"""Example using motion sensor""" + +from time import sleep + +from buildhat import MotionSensor + +motion = MotionSensor('A') + +for _ in range(50): + print(motion.get_distance()) + sleep(0.1) diff --git a/docs/buildhat/motionsensor.rst b/docs/buildhat/motionsensor.rst new file mode 100644 index 0000000..e9d0f5f --- /dev/null +++ b/docs/buildhat/motionsensor.rst @@ -0,0 +1,19 @@ +Motion Sensor +============= + +|location_link| + +.. |location_link| raw:: html + + BrickLink item + +.. autoclass:: buildhat.MotionSensor + :members: + :inherited-members: + +Example +------- + +.. literalinclude:: motion.py + + diff --git a/docs/buildhat/tilt.py b/docs/buildhat/tilt.py new file mode 100755 index 0000000..36ec8d1 --- /dev/null +++ b/docs/buildhat/tilt.py @@ -0,0 +1,11 @@ +"""Example using tilt sensor""" + +from time import sleep + +from buildhat import TiltSensor + +tilt = TiltSensor('A') + +for _ in range(50): + print(tilt.get_tilt()) + sleep(0.1) diff --git a/docs/buildhat/tiltsensor.rst b/docs/buildhat/tiltsensor.rst new file mode 100644 index 0000000..e428882 --- /dev/null +++ b/docs/buildhat/tiltsensor.rst @@ -0,0 +1,19 @@ +Tilt Sensor +=========== + +|location_link| + +.. |location_link| raw:: html + + BrickLink item + +.. autoclass:: buildhat.TiltSensor + :members: + :inherited-members: + +Example +------- + +.. literalinclude:: tilt.py + +