Whitworth-EN173-2016 / Mbed 2 deprecated CAN Diagnostics

Dependencies:   UniGraphic mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "ODBII.h"
00003 #include "globals.h"
00004 #include "pavement_48x34.h"
00005 #include "ILI932x.h"
00006 #include "Arial24x23.h"
00007 /*
00008 This is Ben and I's final project for Embedded Systems. Our goal was to create a car diagnostic system that interfaces with 
00009 the CAN bus in all US sold cars newer than 2008. We aimed to request data such as RPM, Vehicle speed, engine temp, etc and then 
00010 display our findings. This software was succussful in communicating with the car and reading and writing, however it fails
00011 to accompolish it's task when dealing with certain makes of cars, specifically Honda. Included are various PID codes, functions,
00012 and files that interface with a car's CAN bus system.
00013 */
00014 PinName dataBus[]= {p30, p29, p28, p27, p26, p25, p24, p23};
00015 ILI932x myLCD(BUS_8, dataBus, p15, p17, p16, p14, p20, "myLCD", 240, 320);
00016 char orient = 3;
00017 void refresh(float engine);
00018 
00019 
00020 int main() 
00021 {
00022     set_frequency(CANSPEED_500);//set the frequency to deal with the main engine ECU
00023     float engine_info;
00024     myLCD.set_orientation(orient);
00025     myLCD.background(Black);
00026     myLCD.foreground(White);
00027     myLCD.set_font((unsigned char*) Arial24x23);
00028     while(1)
00029     {
00030         if (request(ENGINE_RPM)) //used to check if we can get valid data back
00031         {
00032             engine_info = request(ENGINE_RPM);//if we can, then we're all set to go!
00033             refresh(engine_info);
00034         }
00035         wait(3);
00036     }
00037 
00038     
00039 }
00040 
00041 void refresh(float engine)
00042 {
00043     myLCD.locate(myLCD.width()/2, myLCD.height()/2);
00044     myLCD.printf("Your info is: %f\n\r", engine);
00045 }
00046