CHANDNI RP / Mbed 2 deprecated GSM_SMS

Dependencies:   mbed

Fork of GSM by Harish Mekali

Files at this revision

API Documentation at this revision

Comitter:
chandni
Date:
Fri May 02 06:43:37 2014 +0000
Parent:
0:2a5254679d16
Commit message:
GSM

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue May 07 13:45:44 2013 +0000
+++ b/main.cpp	Fri May 02 06:43:37 2014 +0000
@@ -1,9 +1,12 @@
 #include "mbed.h"
+#include "TextLCD.h"
 char  a=0x1A,e=0x22,c=0x0d;
-char num[] = "9742920934";
+int l =1;
+char num[] = "9538765141";
 
 Serial GSM(p9, p10);  // tx, rx
 Serial pc(USBTX,USBRX);
+TextLCD lcd(p19,p20, p21, p22, p23, p24); // rs, e, d4, d5, d6, d7
 
 ////////////////////////////////////////////////////////////////////
 // fun() - it reads the sensor, writes to LCD and SD card and also senda the data on GSM
@@ -23,25 +26,32 @@
 
 int main()
    {
-   
+  char z[60];
+    
    GSM.baud(9600);
    pc.baud(9600);
    GSM.printf("AT\r\n");
-   GSM.printf("AT+CMGF+1\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);
+      wait(1);
+     //GSM.printf("AT+CMGR=%c\r\n",l);
+   //GSM.printf("ATD9538765141;%c\n",c);
+   GSM.printf("AT+CMSS=1\r");
+   GSM.printf("AT+CMGR=1\r\n");
+   GSM.scanf("%s",&z);
+   //GSM.printf("%c",z);
+   wait(3);
+   
+   pc.printf("%s",z);
   // pc.printf("AT+CMGS=%c%s%c%c\n",e,num,e,c);
    //pc.printf("ATD9538765141;%c\n",c);
-   GSM.printf("Moisture\n\r");
+  // GSM.printf("Moisture\n\r");
   // pc.printf("Moisture\n");
-   GSM.printf("%c",a);
+ //  GSM.printf("%c",a);
   // pc.printf("%c",a);
     
-   wait(1);
+   wait(2);
    }