Add code examples

This commit is contained in:
Konstantin Lampalzer 2021-01-16 01:55:22 +01:00
parent aa33dc36d8
commit ec0b5562cf
No known key found for this signature in database
GPG key ID: 9A60A522835A2AD9
3 changed files with 56 additions and 6 deletions

View file

@ -1,7 +1,23 @@
.. _lib_battery:
Battery
=======
########
Class Documentation
********************
.. autoclass:: compLIB.Battery.Battery
:members:
:members:
Examples
*********
Printing percentage
====================
.. code-block:: python
from compLIB.Battery import Battery
print(Battery.percent())

View file

@ -1,7 +1,25 @@
.. _lib_buzzer:
Buzzer
=======
#######
Class Documentation
********************
.. autoclass:: compLIB.Buzzer.Buzzer
:members:
:members:
Examples
*********
Turning buzzer on and off
==========================
.. code-block:: python
import time
from compLIB.Buzzer import Buzzer
Buzzer.set(True)
time.sleep(1)
Buzzer.set(False)

View file

@ -1,7 +1,23 @@
.. _lib_motor:
Motor
=====
######
Class Documentation
********************
.. autoclass:: compLIB.Motor.Motor
:members:
:members:
Examples
*********
Driving straight (maybe)
=========================
.. code-block:: python
from compLIB.Motor import Motor
for port in range(0, 4):
Motor.power(port, 50)