Public Member Functions | |
def | __init__ (self, pi, trigger, echo) |
def | cancel (self) |
def | read (self) |
Public Attributes | |
pi | |
Private Member Functions | |
def | _cbf (self, gpio, level, tick) |
Private Attributes | |
_cb | |
_echo | |
_echo_mode | |
_high | |
_inited | |
_ping | |
_time | |
_trig | |
_trig_mode | |
_triggered | |
This class encapsulates a type of acoustic ranger. In particular the type of ranger with separate trigger and echo pins. A pulse on the trigger initiates the sonar ping and shortly afterwards a sonar pulse is transmitted and the echo pin goes high. The echo pins stays high until a sonar echo is received (or the response times-out). The time between the high and low edges indicates the sonar round trip time.
Definition at line 7 of file sonar_trigger_echo.py.
def sonar_trigger_echo.ranger.__init__ | ( | self, | |
pi, | |||
trigger, | |||
echo | |||
) |
The class is instantiated with the Pi to use and the gpios connected to the trigger and echo pins.
Definition at line 19 of file sonar_trigger_echo.py.
|
private |
Definition at line 45 of file sonar_trigger_echo.py.
def sonar_trigger_echo.ranger.cancel | ( | self | ) |
Cancels the ranger and returns the gpios to their original mode.
Definition at line 79 of file sonar_trigger_echo.py.
def sonar_trigger_echo.ranger.read | ( | self | ) |
Triggers a reading. The returned reading is the number of microseconds for the sonar round-trip. round trip cms = round trip time / 1000000.0 * 34030
Definition at line 60 of file sonar_trigger_echo.py.
|
private |
Definition at line 40 of file sonar_trigger_echo.py.
|
private |
Definition at line 26 of file sonar_trigger_echo.py.
|
private |
Definition at line 35 of file sonar_trigger_echo.py.
|
private |
Definition at line 29 of file sonar_trigger_echo.py.
|
private |
Definition at line 43 of file sonar_trigger_echo.py.
|
private |
Definition at line 28 of file sonar_trigger_echo.py.
|
private |
Definition at line 30 of file sonar_trigger_echo.py.
|
private |
Definition at line 25 of file sonar_trigger_echo.py.
|
private |
Definition at line 34 of file sonar_trigger_echo.py.
|
private |
Definition at line 32 of file sonar_trigger_echo.py.
sonar_trigger_echo.ranger.pi |
Definition at line 24 of file sonar_trigger_echo.py.