Hello,
I'm new on the forum and quite new on arduino programming. I am trying to connect to my Honda Civic 2015 (model 2013 Civic 9) using Elmduino library but I always have the message error "Couldn't connect to OBD scanner ELMduino".
I am not using Elmduino instrument I just have my own obd connector connected to my teensy 3.2 with the corresponding power but I at the end, I think it should work too.
Here the code I am using just to try the connection.
#include <SoftwareSerial.h>
#include "ELMduino.h"
SoftwareSerial mySerial(4, 3); // RX, TX
#define ELM_PORT mySerial
ELM327 myELM327;
unsigned int mph = 0;
unsigned int RPM;
void setup() {
Serial.begin(115200);
(!Serial);
// mySerial.begin(115200);
// myELM327.begin(mySerial, true, 2000);//ISO_15765_29_BIT_500_KBAUD, 2000);
ELM_PORT.begin(115200);
Serial.println("Attempting to connect to ELM327...");
if (!myELM327.begin(ELM_PORT, true, 2000))
{
Serial.println("Couldn't connect to OBD scanner");
while (1);
}
Serial.println("Connected to ELM327");
}
elapsedMillis DisplayTime; //Establish a timer to prevent unnecessary screen rewrite
void loop(void) {
//Serial.print(mph);
//Serial.print("\n");
//float tempRPM = myELM327.rpm();
float tempRPM = myELM327.batteryVoltage();
RPM = uint32_t(tempRPM);
if (myELM327.nb_rx_state == ELM_SUCCESS)
{
RPM = (uint32_t)tempRPM;
Serial.print("RPM: "); Serial.println(RPM);
mph = 25;
}
else if (myELM327.nb_rx_state != ELM_GETTING_MSG){
myELM327.printError();
mph = 150;
}
else{
mph = 40;
}
}