Dependencies:   FatFileSystem mbed GPS TextLCD

Files at this revision

API Documentation at this revision

Comitter:
pangsk
Date:
Wed Apr 25 09:30:02 2012 +0000
Parent:
2:e7b3b8da71ff
Child:
4:da2b6e61430b
Commit message:
Enable Pullups.

Changed in this revision

ecu_reader.cpp Show annotated file Show diff for this revision Revisions of this file
globals.cpp Show annotated file Show diff for this revision Revisions of this file
globals.h 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
--- a/ecu_reader.cpp	Mon Jul 12 10:03:53 2010 +0000
+++ b/ecu_reader.cpp	Wed Apr 25 09:30:02 2012 +0000
@@ -13,6 +13,7 @@
     can2.frequency(can_speed);
 }
 
+
 #define TIMEOUT 200
 unsigned char ecu_reader::request(unsigned char pid,  char *buffer)
 {
--- a/globals.cpp	Mon Jul 12 10:03:53 2010 +0000
+++ b/globals.cpp	Wed Apr 25 09:30:02 2012 +0000
@@ -1,6 +1,6 @@
 #include "globals.h"
 
-Serial pc (USBTX,USBRX);
+
 
 DigitalOut led1 (LED1);
 DigitalOut led2 (LED2);
--- a/globals.h	Mon Jul 12 10:03:53 2010 +0000
+++ b/globals.h	Wed Apr 25 09:30:02 2012 +0000
@@ -3,7 +3,7 @@
 
 #include "mbed.h"
 
-extern Serial pc;
+
 extern DigitalOut led1;
 extern DigitalOut led2;
 extern DigitalOut led3;
--- a/main.cpp	Mon Jul 12 10:03:53 2010 +0000
+++ b/main.cpp	Wed Apr 25 09:30:02 2012 +0000
@@ -35,15 +35,25 @@
 DigitalIn down(p23);
 DigitalIn left(p24);
 DigitalIn up(p25);
+Serial pc(USBTX, USBRX);
+
 
 ecu_reader obdii(CANSPEED_500);     //Create object and set CAN speed
 void gps_demo(void);
 void sd_demo(void);
 
 int main() {
-    
+    pc.baud(115200);
     char buffer[20];
- 
+    
+    //Enable Pullup 
+    click.mode(PullUp);
+    right.mode(PullUp);
+    down.mode(PullUp);
+    left.mode(PullUp);
+    up.mode(PullUp);
+    
+    printf("ECU Reader \n"); 
     lcd.locate(0,0);                // Set LCD cursor position
     lcd.printf("CAN-Bus demo");
     
@@ -58,6 +68,8 @@
 
     lcd.locate(0,1);
     lcd.printf("U-CAN:D-GPS:L-SD");
+    
+    pc.printf("\nU-CAN:D-GPS:L-SD");
 
     while(1)    // Wait until option is selected by the joystick
     {
@@ -80,6 +92,7 @@
         {
             lcd.locate(0,0);
             lcd.printf(buffer);
+              pc.printf(buffer);
         }   
          
         if(obdii.request(ENGINE_COOLANT_TEMP,buffer) == 1)
@@ -134,6 +147,7 @@
 void sd_demo(void)
 {
     lcd.cls();
+     printf("\nSD demo");
     lcd.printf("SD demo");
     wait(2);      
     lcd.cls();
@@ -142,11 +156,13 @@
     if(fp == NULL) {
         lcd.cls();
         lcd.printf("Could not open file for write\n");
+         pc.printf("\nCould not open file for write");
     }
     fprintf(fp, "Hello fun SD Card World! testing 1234");
     fclose(fp); 
     lcd.locate(0,1);
     lcd.printf("Writtern to SD card");
+    pc.printf("\nWrittern to SD card");
         
     while(1)
     {