This Project allows for you to see live engine data from your vehicle on the LCD display. Utilizing K64F platform,Nokia 5110 LCD and HC05 Bluetooth hardware to interface with an In-Vehicle ELM327 Bluetooth dongle connected to the OBDII port. The K64F system will query the ELM327 device for live engine data and display it onscreen.
Revision 1:2537162d070e, committed 2015-05-12
- Comitter:
- samthomas90
- Date:
- Tue May 12 07:00:33 2015 +0000
- Parent:
- 0:969924e823b4
- Commit message:
- Code Cleaned up
Changed in this revision
N5110.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 969924e823b4 -r 2537162d070e N5110.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/N5110.lib Tue May 12 07:00:33 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/eencae/code/N5110/#ba8addc061ea
diff -r 969924e823b4 -r 2537162d070e main.cpp --- a/main.cpp Tue May 12 03:32:11 2015 +0000 +++ b/main.cpp Tue May 12 07:00:33 2015 +0000 @@ -15,11 +15,8 @@ DigitalIn sw3(SW3); DigitalOut led(LED_RED); -char OBD[3]; - char percent='%'; int flag=1; -char OBD[]={0x01} char zero[2]={0x01,0x0c,}; char OBD[13]; char RPM[13]; @@ -28,7 +25,7 @@ char MAF[13]; char THR[13]; -void OBDInit(void); +int OBDInit(void); void OBDLiveData(void); int main() { char c; @@ -41,12 +38,12 @@ LCD.printString ("-ENHANCED-", 0, 0); LCD.printString ("-VEHICLE-", 0, 1); LCD.printString ("-DIAGNOSTICS-", 0, 2); - LCD.printString ("ECE 595", 0, 3); - LCD.printString ("SAM THOMAS", 0, 4); + //LCD.printString ("ECE 595", 0, 3); + //LCD.printString ("SAM THOMAS", 0, 4); wait(1); LCD.clear(); LCD.printString ("-INITIALIZE-",0, 2); - + OBDInit(); wait(1); LCD.clear(); //HC05.printf(zero); @@ -62,10 +59,13 @@ LCD.printString("THR 60", 0, 4); } + else{ + OBDLiveData(); + } } } -void OBDInit(){ +int OBDInit(){ if(HC05.readable()){ HC05.printf("ATZ\r"); HC05.printf("ATSP0\r"); @@ -74,25 +74,20 @@ } else { - LCD.printString("Bluetooth NOT available"); + LCD.printString("Bluetooth NOT available",0,0); return 0; } } void OBDLiveData(){ + char c; if(HC05.readable()){ - c =HC05.getc(); - - - //SR.putc(c); + c=HC05.getc(); if(c=='~')//Get the initial character sent { flag=0; - //for(int i=0;i<14:i++){ LCD.clear(); //takes in the whole string sent to it From PC below HC05.scanf("%s",&OBD); - //OBD[i]=HC05.getc(); - //} SR.printf(OBD); sprintf(RPM,"RPM %c%c%c%c",OBD[0],OBD[1],OBD[2],OBD[3]); sprintf(SPD,"SPEED %c%cKMPH",OBD[4],OBD[5]); @@ -127,8 +122,6 @@ wait(2); } } - } - + } } - } \ No newline at end of file