OBD2 + RPI3 + OBD2 Bluetooth Adapter = “Connection not defined” HELP plase So close!
Going through your video tutorial on how to connect and get a visual display of OBD2 readout using RPI and OBD2 bluetooth adapter. I have got responses from the adapter using screen. I also got the 3 circles showing during the pygame coding…however when we get to the part to get the data from the OBD2 adapter to the circles I basically get “Connection” “not defined”.
connection.watch(obd.commands.SPEED, callback=get_speed) NameError: name ‘connection’ is not defined
I am using the code just like in the video and on your project page…It seems
connection = obd.OBD() #is commented out
and the ASYNC connection is set. I have tried both and get basically the same error.
Is this basically it saying it cant find the adapter? Should I put in something like
connection = obd.OBD(/dev/rfcomm0)
I believe I have bind the connection to rfcomm0 so not sure where to go from here.
Help…so close … just need the data to get to the pygame circles! Thank you!
It sounds like there’s something wrong with defining “connection”. have you double checked for any typos? If you copied and pasted the code are the tab spaces correct?
So your current “connection” line is defined like this?
connection = obd.Async(fast=False)
My suggestion would be to strip out all the GUI (pygame) elements so that you just have the basic obd calls and see if you can get a response. You can also add lots of python “print …” commands to display where the program is at at any given point. Maybe that’ll help you pinpoint where things are going wrong. Hope that helps!
- Views595 times
- Answers1 answer