- Mon Jan 27, 2014 8:42 am
#5563
Hi all,
I included the library of SoftwareSerial.h in OBD.cpp file:
[code]#include <Arduino.h>
#include <avr/pgmspace.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
#include "OBD.h"[/code]
and modified the original serial of uno to software serial in OBD.h file in the line 17
[code]#ifndef OBDUART
#if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega644P__)
#define OBDUART Serial1
#else
#define OBDUART mySerial
#endif
#endif[/code]
and it complied successfully.
But when I attach the OBD adapter to software serial, the communication between OBD adapter and Arduino is faild and stuck on this loop:
[code]// initiate OBD-II connection until success
while (!obd.init()); [/code]
is there any solution for this?
thank you.