Comments (5)
Do you want engine speed or vehicle speed? If you want vehicle speed in kph, you can use the kph()
function
from elmduino.
from elmduino.
Untested and uncompiled:
#include "BluetoothSerial.h"
#include "ELMduino.h"
BluetoothSerial SerialBT;
#define ELM_PORT SerialBT
#define DEBUG_PORT Serial
ELM327 myELM327;
uint32_t kph = 0;
void setup()
{
#if LED_BUILTIN
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
#endif
DEBUG_PORT.begin(115200);
//SerialBT.setPin("1234");
ELM_PORT.begin("ArduHUD", true);
if (!ELM_PORT.connect("OBDII"))
{
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()
{
float tempKPH = myELM327.kph();
if (myELM327.status == ELM_SUCCESS)
{
kph = tempKPH;
Serial.print("KPH: "); Serial.println(kph);
}
else
printError();
}
void printError()
{
Serial.print("Received: ");
for (byte i = 0; i < myELM327.recBytes; i++)
Serial.write(myELM327.payload[i]);
Serial.println();
if (myELM327.status == ELM_SUCCESS)
Serial.println(F("\tELM_SUCCESS"));
else if (myELM327.status == ELM_NO_RESPONSE)
Serial.println(F("\tERROR: ELM_NO_RESPONSE"));
else if (myELM327.status == ELM_BUFFER_OVERFLOW)
Serial.println(F("\tERROR: ELM_BUFFER_OVERFLOW"));
else if (myELM327.status == ELM_UNABLE_TO_CONNECT)
Serial.println(F("\tERROR: ELM_UNABLE_TO_CONNECT"));
else if (myELM327.status == ELM_NO_DATA)
Serial.println(F("\tERROR: ELM_NO_DATA"));
else if (myELM327.status == ELM_STOPPED)
Serial.println(F("\tERROR: ELM_STOPPED"));
else if (myELM327.status == ELM_TIMEOUT)
Serial.println(F("\tERROR: ELM_TIMEOUT"));
else if (myELM327.status == ELM_TIMEOUT)
Serial.println(F("\tERROR: ELM_GENERAL_ERROR"));
delay(100);
}
from elmduino.
from elmduino.
No prob!
from elmduino.
Related Issues (20)
- set a special pisd of ELMDUINO with header HOT 9
- Setting Protocol not working correctly HOT 6
- Problem querying data with ESP32 HOT 5
- custom pid no response HOT 1
- Sending false Command? HOT 5
- Custom PID for KM since last DPF regeneration HOT 2
- Crash on calling batteryVoltage() HOT 7
- ELM327::isPidSupported Error
- Custom PID, how it works HOT 9
- 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
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.