mirror of
https://github.com/SemvdH/OBD2-car-display.git
synced 2025-12-14 19:51:04 +00:00
Merge branch 'master' of github.com:SemvdH/OBD2-car-display
This commit is contained in:
@@ -23,6 +23,8 @@
|
||||
### HC-05
|
||||
- [Datasheet](https://components101.com/sites/default/files/component_datasheet/HC-05%20Datasheet.pdf)
|
||||
- [How to configure](https://lastminuteengineers.com/hc05-at-commands-tutorial/)
|
||||
- [User Instruction manual](https://www.rcscomponents.kiev.ua/datasheets/hc_hc-05-user-instructions-bluetooth.pdf)
|
||||
- [Interfacing HC05 with Arduino](https://lastminuteengineers.com/hc05-bluetooth-arduino-tutorial/)
|
||||
|
||||
### 3.5 inch TFT display
|
||||
- [Product link](https://www.tinytronics.nl/shop/en/displays/tft/3.5-inch-tft-display-320*480-pixels-mega-compatible-ili9486)
|
||||
|
||||
57
test_elm327.ino
Normal file
57
test_elm327.ino
Normal file
@@ -0,0 +1,57 @@
|
||||
#include "ELMduino.h"
|
||||
|
||||
|
||||
#define ELM_PORT Serial2
|
||||
|
||||
|
||||
ELM327 myELM327;
|
||||
|
||||
|
||||
uint32_t rpm = 0;
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
#if LED_BUILTIN
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
#endif
|
||||
|
||||
Serial.begin(115200);
|
||||
ELM_PORT.begin(115200);
|
||||
|
||||
|
||||
int bt_state = digitalRead(11);
|
||||
while (bt_state == 0)
|
||||
{
|
||||
bt_state = digitalRead(11);
|
||||
Serial.println(bt_state);
|
||||
Serial.println("bt not connected");
|
||||
delay(100);
|
||||
}
|
||||
Serial.println("bt connected");
|
||||
|
||||
Serial.println("Attempting to connect to ELM327...");
|
||||
|
||||
if (!myELM327.begin(ELM_PORT, true, 20000))
|
||||
{
|
||||
Serial.println("Couldn't connect to OBD scanner");
|
||||
while (1);
|
||||
}
|
||||
|
||||
Serial.println("Connected to ELM327");
|
||||
}
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
float tempRPM = myELM327.rpm();
|
||||
|
||||
if (myELM327.nb_rx_state == ELM_SUCCESS)
|
||||
{
|
||||
rpm = (uint32_t)tempRPM;
|
||||
Serial.print("RPM: "); Serial.println(rpm);
|
||||
}
|
||||
else if (myELM327.nb_rx_state != ELM_GETTING_MSG)
|
||||
myELM327.printError();
|
||||
}
|
||||
Reference in New Issue
Block a user