python-OBD
python-OBD copied to clipboard
Async Readout Reads None for the first few queries, then returns value
as it states above, im trying to readout RPM in the async function, but it reads none for the first few times then catches up and gives a readout. Also I dont see in the docs how to return the value as an int or the RPMs only and not the revolutions_per_Minute part. For some reason it also returns none when the async query command is set to a variable. Any help would be appreciated. Code:
def StartAsyncOBDConnection
global AsyncConnection
AsyncConnection = obd.Async()
AsyncConnection.watch(obd.commands.RPM)
#AsyncRPM = AsyncConnection.query(obd.commands.RPM) (if you use this in place of just writing it out in the function below, it returns none no matter what...)
count = 0
#Simple counter, that way the while loop queries for information but eventually stops, good for testing
while count < 300
print(AsyncConnection.query(obd.commands.RPM))
#for other issue, replace AsyncConnection.query(obd.commands.RPM)) with AsyncRPM Variable.
count += 1
time.sleep(0.1)