Skip to content

Made README.rst renderable by PyPI #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,20 @@ You'll need to dedicate two pins to communicating with the HC-SR04. The sensor c
manner, so it doesn't matter which pins you choose, as long as they're digital IO pins (pins that start with "``D``"
are digital).

There are two ways of instantiating a :class:`~hcsr04.HCSR04` object: with or without using a context manager.
There are two ways of instantiating a `HCSR04` object: with or without using a context manager.

.. note::

It is technically possible to communicate with the HC-SR04 using only one wire since the trigger and echo signals
aren't ever active at the same time. Once I have a chance to determine a safe way to do this, I plan to add this as
a feature to the library.

.. seealso::
See Also:

`Adafruit's guide on Lifetime and ContextManagers <https://circuitpython.readthedocs.io/en/latest/docs/design_guide.html#lifetime-and-contextmanagers>`_
Gives more info on using context managers with CircuitPython drivers.

:any:`board`
`board <https://circuitpython.readthedocs.io/en/latest/shared-bindings/board/__init__.html#module-board>`_
A list of pins available on your device. To view this list, first `get a REPL
<http://circuitpython.readthedocs.io/en/latest/docs/pyboard/tutorial/repl.html>`_ (the guide linked was written
for the pyboard, but it still works), then input the following:
Expand All @@ -98,7 +98,7 @@ There are two ways of instantiating a :class:`~hcsr04.HCSR04` object: with or wi
Without a Context Manager
-------------------------

In the example below, we create the :class:`~hcsr04.HCSR04` object directly, get the distance every 2 seconds, then
In the example below, we create the `HCSR04` object directly, get the distance every 2 seconds, then
de-initialize the device.

::
Expand All @@ -117,7 +117,7 @@ de-initialize the device.
With a Context Manager
----------------------

In the example below, we use a context manager (the :any:`with <with>` statement) to create the :class:`~hcsr04.HCSR04`
In the example below, we use a context manager (the `with <https://docs.python.org/3.4/reference/compound_stmts.html#with>`_ statement) to create the `HCSR04`
instance, again get the distance every 2 seconds, but then the context manager handles de-initializing the device for
us.

Expand Down