gsm1

Dependencies:   TextLCD mbed

Fork of GSM by gowrishankar N J

Revision:
1:641050920d1e
Parent:
0:2a5254679d16
Child:
2:9a9fa2279b8e
--- a/main.cpp	Tue May 07 13:45:44 2013 +0000
+++ b/main.cpp	Fri May 02 07:42:34 2014 +0000
@@ -1,51 +1,38 @@
 #include "mbed.h"
+#include "Serial.h"
+DigitalOut myled(LED1);
 char  a=0x1A,e=0x22,c=0x0d;
-char num[] = "9742920934";
+//char  a=0x1A,e=0x22,c=0x0d;
+//char num[] = "9740647273";
+
 
-Serial GSM(p9, p10);  // tx, rx
+//char *txt;
+
+Serial GSM(p9,p10);  // tx, rx
 Serial pc(USBTX,USBRX);
 
-////////////////////////////////////////////////////////////////////
-// fun() - it reads the sensor, writes to LCD and SD card and also senda the data on GSM
-////////////////////////////////////////////////////////////////////
-
-/*void fun()
-{
-      
-        //GSM.printf("AT+CMGS=%c%s%c\r\n",e,num,e);
-       // GSM.printf("ATD9538765141;\n");
-       // pc.printf("ATD9538765141;\n");
-        //wait(3);
-        //GSM.printf("Moisture");
-        //GSM.printf("%c",a);
-        return ;
-}*/
-
-int main()
-   {
-   
-   GSM.baud(9600);
-   pc.baud(9600);
-   GSM.printf("AT\r\n");
-   GSM.printf("AT+CMGF+1\r\n");
-   while(1)
-   {
-      wait(3);
-     
-   //GSM.printf("ATD9742920934;%c\n",c);
-   GSM.printf("AT+CMGS=%c%s%c\r\n",e,num,e);
-  // pc.printf("AT+CMGS=%c%s%c%c\n",e,num,e,c);
-   //pc.printf("ATD9538765141;%c\n",c);
-   GSM.printf("Moisture\n\r");
-  // pc.printf("Moisture\n");
-   GSM.printf("%c",a);
-  // pc.printf("%c",a);
-    
-   wait(1);
-   }
-    
-   
-   }
+char sm[3]="SM";
+char all[4]="ALL";
 
 
 
+int main()
+{
+   char  z[120];
+   int i=0;   
+   GSM.baud(9600);
+   pc.baud(9600);
+  GSM.printf("AT+CMGR=1\r\n");
+   //wait(2);
+   while(1)
+   {
+   while(!GSM.readable())
+   {}
+  // pc.printf("aaa");
+   GSM.scanf("%c",&z[i]);
+   i++;
+   if(i==120)break;
+   }
+   pc.printf("%s",z);
+}
+   
\ No newline at end of file