From 3b18b0a66cab895a2626e9e60af4b6240c4e97ac Mon Sep 17 00:00:00 2001 From: Konstantin Lampalzer Date: Sat, 16 Jan 2021 23:41:39 +0100 Subject: [PATCH] Documentation --- README.md | 9 +++++++++ compLib/LogstashLogging.py | 2 +- docs/source/index.rst | 16 ++++++---------- docs/source/other/usage.rst | 28 ++++++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 11 deletions(-) create mode 100644 docs/source/other/usage.rst diff --git a/README.md b/README.md index 50424e7..5a9ed13 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,15 @@ Need dependencies: https://github.com/Freenove/Freenove_RPI_WS281x_Python +# Dependencies + +## Building documentation +``` +pip install sphinx-rtd-theme +``` + +* [Sphinx](https://www.sphinx-doc.org/en/master/usage/installation.html) + # Writing docs [Inline documentation example](https://pythonhosted.org/an_example_pypi_project/sphinx.html#full-code-example) diff --git a/compLib/LogstashLogging.py b/compLib/LogstashLogging.py index 5e417b3..d507925 100644 --- a/compLib/LogstashLogging.py +++ b/compLib/LogstashLogging.py @@ -23,7 +23,7 @@ asynchronousLogstashHandler = AsynchronousLogstashHandler( host, port, transport=transport, - database_path='logstash_test.db' + database_path='logs.db' ) class StreamToLogger(object): diff --git a/docs/source/index.rst b/docs/source/index.rst index c207a90..2c0ae75 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -1,25 +1,21 @@ -Welcome to CompLib's documentation! -=================================== +Robo4you Competition Library +############################# .. toctree:: :maxdepth: 2 :caption: Contents: -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` +CompLib is the library used in the robo4you competition 2021. -Table of Contents -^^^^^^^^^^^^^^^^^ +Contents +********* .. toctree:: :maxdepth: 5 :glob: self + other/usage lib/* diff --git a/docs/source/other/usage.rst b/docs/source/other/usage.rst new file mode 100644 index 0000000..93b2425 --- /dev/null +++ b/docs/source/other/usage.rst @@ -0,0 +1,28 @@ +.. _other_usage: + +Usage +###### + +.. code-block:: python + + import time + from compLib.Motor import * + + def forward(): + for port in range(0, 3): + Motor.power(port, 30); + + def backward(): + for port in range(0, 3): + Motor.power(port, -30); + + def main(): + print("hallo ich bin ein roboter beep buup") + + forward() + time.sleep(1) + backward() + time.sleep(1) + + if __name__ == '__main__': + main() \ No newline at end of file