
import obd

connection = obd.OBD()

while true:
    request = connection.query(obd.commands.RPM)

    if not r.is_null():
        print(r.value)

import obd
import signal
import sys

#What to do when we receive a signal
def signal_handler(signal, frame):
    connection.close()
    sys.exit(0)
	
#Register our signal handler
signal.signal(signal.SIGINT, signal_handler)

#Find and connect OBD adapter
connection = obd.OBD()

while True:
    request = connection.query(obd.commands.RPM)

    if not request.is_null():
        print(request.value)
Handle ctrl+c with signal Fix more typos
Handle ctrl+c with signal
Fix more typos

  
  import obd
+ import signal
+ import sys
  
+ #What to do when we receive a signal
+ def signal_handler(signal, frame):
+     connection.close()
+     sys.exit(0)
+ 	
+ #Register our signal handler
+ signal.signal(signal.SIGINT, signal_handler)
+ 
+ #Find and connect OBD adapter
  connection = obd.OBD()
  
- while true:
+ while True:
      request = connection.query(obd.commands.RPM)
  
-     if not r.is_null():
+     if not request.is_null():
-         print(r.value)
+         print(request.value)
Handle ctrl+c with signal Fix more typos
## Code Before:

import obd

connection = obd.OBD()

while true:
    request = connection.query(obd.commands.RPM)

    if not r.is_null():
        print(r.value)
## Instruction:
Handle ctrl+c with signal Fix more typos
## Code After:

import obd
import signal
import sys

#What to do when we receive a signal
def signal_handler(signal, frame):
    connection.close()
    sys.exit(0)
	
#Register our signal handler
signal.signal(signal.SIGINT, signal_handler)

#Find and connect OBD adapter
connection = obd.OBD()

while True:
    request = connection.query(obd.commands.RPM)

    if not request.is_null():
        print(request.value)