Dependencies:   FatFileSystem mbed GPS TextLCD

Revision:
2:e7b3b8da71ff
Parent:
1:3552a3289608
Child:
3:05bb8f0bd7a4
--- a/main.cpp	Thu Jul 08 21:37:12 2010 +0000
+++ b/main.cpp	Mon Jul 12 10:03:53 2010 +0000
@@ -24,9 +24,11 @@
 #include "globals.h"
 #include "TextLCD.h"
 #include "GPS.h"
+#include "SDFileSystem.h"
 
 GPS gps(p28, p27);
 TextLCD lcd(p18, p19, p20, p17, p16, p15, p14); // rs, rw, e, d0, d1, d2, d3
+SDFileSystem sd(p5, p6, p7, p13, "sd");
 
 DigitalIn click(p21);   // Joystick inputs
 DigitalIn right(p22);
@@ -42,7 +44,7 @@
     
     char buffer[20];
  
-    lcd.locate(0,0);
+    lcd.locate(0,0);                // Set LCD cursor position
     lcd.printf("CAN-Bus demo");
     
     lcd.locate(0,1);
@@ -103,7 +105,6 @@
 
 void gps_demo(void)
 {
-    pc.printf("\rGPS demo");
     lcd.cls();
     lcd.printf("GPS demo");
     lcd.locate(0,1);
@@ -111,8 +112,7 @@
  
     wait(3);    
     lcd.cls();
-    
-    
+   
     while(1)
     {
       if(gps.sample()) {
@@ -125,28 +125,36 @@
             pc.printf("Oh Dear! No lock :(\n");
             lcd.cls();
             lcd.printf("Waiting for lock");
-     
- 
-    
+   
         }
-    
-    
     }
  
 }
 
 void sd_demo(void)
 {
-    pc.printf("\rSD demo");
-    
+    lcd.cls();
+    lcd.printf("SD demo");
+    wait(2);      
     lcd.cls();
-    lcd.printf("Use joystick");
-    wait(3);      
+    
+    FILE *fp = fopen("/sd/sdtest2.txt", "w");
+    if(fp == NULL) {
+        lcd.cls();
+        lcd.printf("Could not open file for write\n");
+    }
+    fprintf(fp, "Hello fun SD Card World! testing 1234");
+    fclose(fp); 
+    lcd.locate(0,1);
+    lcd.printf("Writtern to SD card");
+        
     while(1)
     {
-    
-    
-    
+        led2 = 1;
+        wait(0.1);
+        led2 = 0;
+        wait(0.1);
+   
     }
  
 }