I was trying to connect ESP32 with OBD II adapter - ELM327 over bluetooth. I tried various options and generally, ELM 327 is receiving my messages, but don't answer them.
I tried to communicate ESP32 with Android phone without password and BT Serial communication works properly.
But in my primary case, I'd connect ESP32 as master, initiator device to ELM327 (slave). I cannot turn off PIN in ELM device..
Code: Select all
#include "BluetoothSerial.h"
BluetoothSerial SerialBT;
String MACadd = "AA:BB:CC:11:22:33";
uint8_t address[6] = {0xAA, 0xBB, 0xCC, 0x11, 0x22, 0x33};
String name = "OBDII";
char *pin = "1234"; //<- standard pin would be provided by default
bool connected;
void setup(){
Serial.begin(115200);
SerialBT.setPin(pin);
SerialBT.begin("ESP32", true);
Serial.println("The device started in master mode, make sure remote BT device is on!");
connected = SerialBT.connect(address);
if(connected) {
Serial.println("Connected Succesfully!");
}else {
while(!SerialBT.connected(10000)) {
Serial.println("Failed to connect. Make sure remote device is available and in range, then restart app.");
}
}
}
void loop() {
if(Serial.available()){
SerialBT.write(Serial.read());
}
if(SerialBT.available()){
Serial.write(SerialBT.read());
}
delay(20);
}
After uploading following code, I'm getting an error on serial monitor:
Code: Select all
ASSERT_WARN(1 8), in lc_task.c at line 5054
Could anybody give me some advices?
Thanks.