I am using this code.
As i cannot use a laptop in the car i cannot read out the serial monitor
But i get no rpm on the display. The value stays zero (0)
What am i doing wrong?
As the screen goes black before the 0 appears, i assume the esp32 is connected to the elm327. And in the test with the elm powered bij 12v the serial reports that they are connected.
#include "BluetoothSerial.h"
#include "ELMduino.h"
#include <Adafruit_GFX.h>
#include <Adafruit_ILI9341.h>
#define TFT_SCK 18
#define TFT_MOSI 23
#define TFT_MISO 19
#define TFT_CS 22
#define TFT_RST 17
#define TFT_DC 21
#define ELM_PORT SerialBT
#define DEBUG_PORT Serial
BluetoothSerial SerialBT;
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);
uint8_t address[6] = {0x88, 0x18, 0x56, 0x68, 0x98, 0xEB};
ELM327 myELM327;
uint32_t rpm = 0;
uint32_t cool = 0;
void setup()
{
DEBUG_PORT.begin(115200);
ELM_PORT.begin("ArduHUD", true);
tft.begin();
tft.setRotation(3);
tft.fillScreen(ILI9341_BLACK);
tft.setCursor(50, 20);
tft.setTextSize(3);
tft.setTextColor(ILI9341_RED);
tft.print("OPSTARTEN....");
if (!ELM_PORT.connect(address))
{
DEBUG_PORT.println("Couldn't connect to OBD scanner - Phase 1");
while (1);
}
if (!myELM327.begin(ELM_PORT))
{
Serial.println("Couldn't connect to OBD scanner - Phase 2");
while (1);
}
Serial.println("Connected to ELM327");
tft.fillScreen(ILI9341_BLACK);
}
void loop()
{
float tempRPM = myELM327.rpm();
rpm = (uint32_t)tempRPM;
tft.print(rpm);
tft.setCursor(50, 40);
float tempcool = myELM327.engineCoolantTemp();
cool = (uint32_t)tempcool;
tft.print(cool);
}
I connected the elm to an android phone with torque and there i got values, so the elm looks like its working👍🏻