I am running this on a Mega, and want to connect the OBD adapter to a different serial port. Nowhere in the initialization do you have to define which port it's connected to. How do i define which port it's connected to?
Here's the default code provided on the OBD-II adapter page. Nowhere does it define which port the device uses.
#include <Wire.h>
#include <obd.h>
COBD obd; /* for Model A (UART version) */
void setup()
{
// we'll use the debug LED as output
pinMode(13, OUTPUT);
// start communication with OBD-II adapter
obd.begin();
// initiate OBD-II connection until success
while (!obd.init());
}
void loop()
{
int value;
// save engine RPM in variable 'value', return true on success
if (obd.read(PID_RPM, value)) {
// light on LED on Arduino board when the RPM exceeds 3000
digitalWrite(13, value > 3000 ? HIGH : LOW);
}
}