obd
obd copied to clipboard
Error when i try to show some informations
Here is my code:
require 'obd'
obd = OBD.connect '/dev/tty.OBDII-SPP', 38400
puts obd[:engine_rpm]
puts obd[:vehicle_speed]
/Users/renatoramiro/.rvm/gems/ruby-2.2.0/gems/obd-0.0.3/lib/obd/command.rb:10:in `to_i': wrong number of arguments (1 for 0) (ArgumentError)
from /Users/renatoramiro/.rvm/gems/ruby-2.2.0/gems/obd-0.0.3/lib/obd/command.rb:10:in `format_result'
from /Users/renatoramiro/.rvm/gems/ruby-2.2.0/gems/obd-0.0.3/lib/obd/connection.rb:26:in `[]'
from first_test.rb:3:in `<main>'
I'm having the same issue. It seems that nothing's being read from the device, so it fails when it tries to convert ""
to hex.
I've run pry
at a terminal, instanced the connection with obd = OBD.connect '/dev/tty.OBDII-SPP'
, cd obd
to be in the context of that object, and doing read
returns an empty string after the timeout value (2 seconds by default, but I've changed it and the delay changes.
I'm using a Bluetooth OBDII Scanner that works great with my Samsung S4, but I can't get it to work from a MacBookPro running OSX Mavericks (10.9.5).
You'll have a better message explaining this if you use the code in #2