Comments (15)
What do you get if you use this code?
Serial.print("Batt: ");
myELM327.sendCommand(READ_VOLTAGE);
Serial.write(myELM327.payload, myELM327.recBytes)
Serial.println("V");
from elmduino.
Thanks for reply, I will try tonight & let you know the result.
from elmduino.
@PowerBroker2 ,
seem like the code not working, it stuck at below code
Serial.write(myELM327.payload, myELM327.recBytes)
error message below
ESP32_Bluetooth_Serial:56:23: error: invalid conversion from 'char*' to 'const uint8_t* {aka const unsigned char*}' [-fpermissive]
Serial.write(myELM327.payload, myELM327.recBytes)
^
I was using the example from your library ESP32_Bluetooth_Serial.ino
remark out the below 3 lines
float tempRPM = myELM327.rpm();
rpm = (uint32_t)tempRPM;
Serial.print("RPM: "); Serial.println(rpm);
& add in the command that you give after the below command
if (myELM327.status == ELM_SUCCESS)
Serial.print("Batt: ");
myELM327.sendCommand(READ_VOLTAGE);
Serial.write(myELM327.payload, myELM327.recBytes);
Serial.println("V");
Just found up if I modify the code become like below, it works !!
Serial.print("Batt: ");
myELM327.sendCommand(READ_VOLTAGE);
Serial.write(myELM327.payload);
Serial.println(" ");
Result in serial monitor as below
Batt: 12.2V <--I not sure where the V coming from ........
But if I change the code to below
Serial.print("Batt: ");
myELM327.sendCommand(READ_VOLTAGE);
Serial.write(myELM327.recBytes);
Serial.println(" ");
Result in serial monitor as below
Batt: � <--I not sure what is generate out, is like a square symbol.
So the data is in payload? what is recBytes store actually?
from elmduino.
Sorry about the error, I forgot the ESP32 handles Serial.write()
strangely. Try this instead:
Serial.print("Batt: ");
myELM327.sendCommand(READ_VOLTAGE);
Serial.write((const uint8_t*)myELM327.payload, (uint8_t)myELM327.recBytes)
Serial.println("V");
myELM327.payload
is a buffer for the characters returned from the ELM327 and myELM327.recBytes
is the total number of characters returned from the ELM327 and stuffed in the buffer myELM327.payload
.
from elmduino.
seem like the result is same for below 2 command,
Serial.write(myELM327.payload);
Serial.write((const uint8_t*)myELM327.payload, (uint8_t)myELM327.recBytes)
Batt: 12.1vv <-- ya, double V somehow, I just remove the print V command.
but if I print the result to LCD screen using (myELM327.payload), then the result is different.
LCD screen will show below
ATRV12.1v <--show the ATRV command in front although I didnt specify it.
from elmduino.
Looks like the library is working as intended - the LCD portion depends on your code. Can you confirm?
from elmduino.
for the LCD portion, I just code it as below
lcd.print(myELM327.payload);
maybe need to add the filter for filter up the ATRV wording? I'm still very new to this coding, will take sometime to dig it or you have any idea?
from elmduino.
Maybe. Can you post your entire sketch?
from elmduino.
I'm simplify my code as below, LCD library take from https://github.com/Bodmer/TFT_eSPI
the LCD will display result as below
OBD voltage: ATRV12.4V
#include <TFT_eSPI.h>
#include "BluetoothSerial.h"
#include "ELMduino.h"
TFT_eSPI lcd = TFT_eSPI();
#define BLK 0x0000
BluetoothSerial SerialBT;
#define ELM_PORT SerialBT
#define DEBUG_PORT Serial
ELM327 myELM327;
void setup()
{
lcd.init();
lcd.fillScreen(BLK);
lcd.setRotation(1);
lcd.setTextSize(3);
Serial.begin(115200);
ELM_PORT.begin("ArduHUD", true);
if (!ELM_PORT.connect("OBDLink LX"))
{
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");
}
void loop()
{
lcd.setCursor(0, 0, 1);
lcd.print("OBD voltage: ");
myELM327.sendCommand(READ_VOLTAGE);
lcd.print(myELM327.payload);
}
from elmduino.
That sketch doesn't send any manual AT commands. Please update your comment with the correct sketch.
from elmduino.
That sketch doesn't send any manual AT commands. Please update your comment with the correct sketch.
@PowerBroker2 sorry, I forgot to add in the below line. Please find the update comment above.
myELM327.sendCommand(READ_VOLTAGE);
from elmduino.
Try lcd.write(myELM327.payload, myELM327.recBytes)
from elmduino.
Will try tonight & let you know the results
from elmduino.
using both command below also come out the same error
lcd.write(myELM327.payload, myELM327.recBytes)
lcd.print(myELM327.payload, myELM327.recBytes)
no matching function for call to 'TFT_eSPI::write(char*&, uint16_t&)'
I will try to figure out as your library is actually working.
from elmduino.
Ok, sounds good. You'll probably find more help if you post on the Arduino forum.
from elmduino.
Related Issues (20)
- PID 70: Boost pressure control (Service 01) HOT 1
- Problem with flashing RPM value on OLED when using latest version of ELMduino HOT 8
- ESP32 not connecting to ELM327 HOT 5
- Protocol Data Point HOT 4
- Couldn't connect to OBD scanner (stucked) HOT 18
- First time Bluetooth pairing between ESP32 and ELM327 HOT 1
- custom pid for DPF HOT 17
- BT Pairing problem between ESP-32 and ELM327 HOT 6
- How to change OBD protocol HOT 5
- Response not detected HOT 28
- Error in getting Multiple PID's HOT 9
- ESP32 s3 BLE compatibility? HOT 3
- Attempting to read non-standard PID HOT 1
- When does `queryPid` return `true`? HOT 4
- ESP32_CheckPIDs_1_20.ino HOT 1
- How to read data if I know TXD RXF RXD and MTH HOT 2
- ERROR: ELM_BUFFER_OVERFLOW on Honda Vezel 2023 HOT 4
- Problems in phase 1, can't connect with ELM327 HOT 3
- couldn't connect to OBD scanner HOT 5
- ERROR: ELM_TIMEOUT . Value received for a while and then error happens. HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elmduino.