I am using an OBD2 adapter which is working fine together with arduino nano and following code :
#include <LiquidCrystal.h>
LiquidCrystal lcd(8, 9, 4, 5, 6, 7); // select the pins used on the LCD panel
#include <OBD2UART.h>
COBD obd;
void setup()
{
// we'll use the debug LED as output
// start communication with OBD-II UART adapter
obd.begin();
lcd.begin(16, 2);
// initiate OBD-II connection until success
while (!obd.init());
}
void loop()
{
int value;
obd.readPID(PID_RPM, value);
int value2;
obd.readPID(PID_COOLANT_TEMP, value2);
lcd.setCursor(0,0);
lcd.print("RPM = ");
lcd.print(value);
lcd.print(" ");
lcd.setCursor(0,1);
lcd.print("ECT = ");
lcd.print(value2);
lcd.print(" ");
}
Connection is very simple: gnd - gnd / rx and tx
My problem is that if I use a nodemcu board instead of nano the code is blocking on " while (!obd.init()); ".
Any idea why ?
Thanks a lot in advance.