diff --git a/README.rst b/README.rst index 56d0263..6fb1074 100644 --- a/README.rst +++ b/README.rst @@ -90,7 +90,7 @@ See Also: `_ (the guide linked was written for the pyboard, but it still works), then input the following: - :: + .. code-block:: python import board dir(board) @@ -101,13 +101,14 @@ Without a Context Manager In the example below, we create the `HCSR04` object directly, get the distance every 2 seconds, then de-initialize the device. -:: +.. code-block:: python + import board from adafruit_hcsr04 import HCSR04 - sonar = HCSR04(trig, echo) + sonar = HCSR04(trigger_pin=board.D5, echo_pin=board.D6) try: while True: - print(sonar.dist_cm()) + print(sonar.distance) sleep(2) except KeyboardInterrupt: pass @@ -121,13 +122,14 @@ In the example below, we use a context manager (the `with