adapter V2.0 with software serial.

Inquiry and support for Freematics products
Post Reply
kjh
Posts: 1
Joined: Fri Mar 19, 2021 4:10 pm

adapter V2.0 with software serial.

Post by kjh »

Hello?

I'm using adapter v2.0 with software Serial.
I plugged adapter's white line to my arduino UNO pin3, and green line to pin2.

I plugged adapter to OBD2 port but It seems nothing happened to my laptop serial monitor.

Is there any error with my code?



#include <OBD2UART.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3);

COBD obd;

void readPIDSingle()
{
int value;

if (obd.readPID(PID_RPM, value)) {
mySerial.print(value);
Serial.print(value);
}
mySerial.println();
Serial.println();
}

void setup()
{
mySerial.begin(115200);
while (!mySerial);
obd.begin();

// initialize OBD-II adapter
do {
mySerial.println("Connecting...");
Serial.println("Connecting...");
} while (!obd.init());
mySerial.println("OBD connected!");
Serial.println("OBD connected!");
}

void loop()
{
readPIDSingle();
}
stanley
Site Admin
Posts: 1039
Joined: Sat Mar 01, 2014 3:15 am

Re: adapter V2.0 with software serial.

Post by stanley »

Be aware software serial is never stable above 38400bps on ATmega328.
Post Reply