gsm1

Dependencies:   TextLCD mbed

Fork of GSM by gowrishankar N J

Revision:
2:9a9fa2279b8e
Parent:
1:641050920d1e
--- a/main.cpp	Fri May 02 07:42:34 2014 +0000
+++ b/main.cpp	Mon May 05 14:35:06 2014 +0000
@@ -1,6 +1,9 @@
 #include "mbed.h"
 #include "Serial.h"
+#include "TextLCD.h"
+#include "cstring"
 DigitalOut myled(LED1);
+TextLCD lcd(p19, p20, p21, p22, p23, p24);
 char  a=0x1A,e=0x22,c=0x0d;
 //char  a=0x1A,e=0x22,c=0x0d;
 //char num[] = "9740647273";
@@ -10,29 +13,75 @@
 
 Serial GSM(p9,p10);  // tx, rx
 Serial pc(USBTX,USBRX);
+void lcddisp(char *s);
 
 char sm[3]="SM";
 char all[4]="ALL";
-
-
+char *s;
+char *p='\0';
+int countSpace=0;
 
 int main()
 {
-   char  z[120];
-   int i=0;   
    GSM.baud(9600);
    pc.baud(9600);
-  GSM.printf("AT+CMGR=1\r\n");
+char  z[141];
+    int i=0;
+    
+   
+   
+    
+   
+  GSM.printf("AT+CMGR=1\r\r");
    //wait(2);
+   //lcd.printf("\n");
+   
    while(1)
+   
    {
-   while(!GSM.readable())
-   {}
+       while(!GSM.readable())
+       {};
+        
+   //do{
   // pc.printf("aaa");
+   
    GSM.scanf("%c",&z[i]);
    i++;
-   if(i==120)break;
-   }
-   pc.printf("%s",z);
+//   if(countSpace >= 13)
+//         break;
+//      if(z[i] == ' ')
+//        countSpace++;  
+//   }
+    
+lcd.printf("\n");
+if(i==141) break;
 }
+    for(i=82;i<141;i++)
+    {
+        wait(0.2);
+      lcd.printf("%c",z[i]);
+     
+    //lcd.printf("%s",);
+        wait(0.25);
+    }
+ 
+  //lcddisp(z);
+   
+   wait(10);
+   GSM.printf("AT+CMGD=1\r\n");
+  wait(2);
+ }  
+
+
+//void lcddisp(char *s)
+//{
+//    int l=strlen(s);
+//    for(int i=80;i<l;i++)
+//    {
+//        lcd.printf("%c",s[i]);
+//        wait(1);
+//    }
+//}
+        
+
    
\ No newline at end of file