Skip to content

Commit f306be5

Browse files
author
Brendan Whitfield
committed
made the readme short and sweet (moved stuff to the wiki)
1 parent 2acdea0 commit f306be5

2 files changed

Lines changed: 15 additions & 68 deletions

File tree

‎README.rst‎

Lines changed: 13 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
python-OBD
22
==========
33

4-
A python module for handling realtime sensor data from OBD-II vehicle ports
5-
6-
This library is forked from:
7-
8-
+ https://github.com/peterh/pyobd
9-
+ https://github.com/Pbartek/pyobd-pi
4+
A python module for handling realtime sensor data from OBD-II vehicle ports.
105

116
Installation
127
------------
@@ -23,59 +18,23 @@ Dependencies
2318
+ OBD-II adapter (ELM327 Bluetooth Adapter or ELM327 USB Cable)
2419

2520

26-
Usage
27-
-----
28-
29-
After installing the library, simply import 'obd', and create a new OBD connection object. By default, python-OBD will scan for Bluetooth and USB serial ports (in that order), and will pick the first connection it finds. The port can also be specified manually by passing a connection string to the OBD constructor. You can also use the scanSerial helper retrieve a list of connected ports::
30-
31-
import obd
32-
33-
connection = obd.OBD() # create connection object
34-
35-
# OR
36-
37-
connection = obd.OBD("/dev/ttyUSB0") # create connection with USB 0
38-
39-
# OR
40-
41-
ports = obd.scanSerial() # return list of valid USB or RF ports
42-
print ports
43-
connection = obd.OBD(ports[0]) # connect to the first port in the list
44-
45-
46-
Once a connection is made, python-OBD will load a list of the available commands in your car. A "Command" in python-OBD is an object used to query specific information from the vehicle. A command object contains its name, units, codes, and decoding functions. To get the value of a sensor, call the query() function with that sensor's command as an argument::
47-
48-
import obd
49-
50-
connection = obd.OBD()
51-
52-
for command in connection.supportedCommands:
53-
print str(command) # prints the command name
54-
response = connection.query(command) # sends the command, and returns the decoded response
55-
print response.value, response.unit # prints the data and units returned from the car
56-
21+
Basic Usage
22+
-----------
5723

58-
Commands can also be accessed explicitly, either by name, or by code value. The has_command() function will determine whether or not your car supports the requested command::
24+
After installing the library, simply import 'obd', and create a new OBD connection object. Commands can then be sent to the car using the `query` function::
5925

6026
import obd
6127

62-
connection = obd.OBD()
63-
64-
65-
c = obd.commands.RPM
66-
67-
# OR
28+
connection = obd.OBD() # auto-connects to USB or RF port
6829

69-
c = obd.commands['RPM']
30+
cmd = obd.commands.RPM # select an OBD command (sensor)
7031

71-
# OR
32+
response = connection.query(cmd) # send the command, and parse the response
7233

73-
c = obd.commands[1][12] # mode 1, PID 12 (decimal)
74-
75-
76-
if connection.has_command(c): # check for existance of sensor
77-
print connection.query(c).value # get and print value of sensor
34+
print(response.value)
35+
print(response.unit)
7836

37+
For more in-depth documentation, `visit the Wiki! <http://github.com/brendanwhitfield/python-OBD/wiki>`
7938

8039
Here are a few of the currently supported commands (note: support for these commands will vary from car to car):
8140

@@ -101,21 +60,9 @@ Here are a few of the currently supported commands (note: support for these comm
10160
+ Engine fuel rate
10261
+ etc... (for a full list, see `commands.py <http://github.com/brendanwhitfield/python-OBD/blob/master/obd/commands.py#L106>`_)
10362

63+
This library is forked from:
10464

105-
Debug
106-
-----
107-
108-
python-OBD also contains a debug object that can be used to print status messages and errors. Console printing is disabled by default, but can be enabled manually. A custom debug handler can also be set::
109-
110-
import obd
111-
112-
obd.debug.console = True
113-
114-
# AND / OR
115-
116-
def log(msg):
117-
print msg
118-
119-
obd.debug.handler = log
65+
+ https://github.com/peterh/pyobd
66+
+ https://github.com/Pbartek/pyobd-pi
12067

12168
Enjoy and drive safe!

‎obd/__init__.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@
2929
########################################################################
3030

3131
from obd import OBD
32-
from commands import commands
33-
from utils import scanSerial
32+
from commands import commands, OBDCommand
33+
from utils import scanSerial, Unit
3434
from debug import debug

0 commit comments

Comments
 (0)