Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of GSM by
main.cpp
00001 #include "mbed.h" 00002 #include "Serial.h" 00003 #include "TextLCD.h" 00004 #include "cstring" 00005 DigitalOut myled(LED1); 00006 TextLCD lcd(p19, p20, p21, p22, p23, p24); 00007 char a=0x1A,e=0x22,c=0x0d; 00008 //char a=0x1A,e=0x22,c=0x0d; 00009 //char num[] = "9740647273"; 00010 00011 00012 //char *txt; 00013 00014 Serial GSM(p9,p10); // tx, rx 00015 Serial pc(USBTX,USBRX); 00016 void lcddisp(char *s); 00017 00018 char sm[3]="SM"; 00019 char all[4]="ALL"; 00020 char *s; 00021 char *p='\0'; 00022 int countSpace=0; 00023 00024 int main() 00025 { 00026 GSM.baud(9600); 00027 pc.baud(9600); 00028 char z[141]; 00029 int i=0; 00030 00031 00032 00033 00034 00035 GSM.printf("AT+CMGR=1\r\r"); 00036 //wait(2); 00037 //lcd.printf("\n"); 00038 00039 while(1) 00040 00041 { 00042 while(!GSM.readable()) 00043 {}; 00044 00045 //do{ 00046 // pc.printf("aaa"); 00047 00048 GSM.scanf("%c",&z[i]); 00049 i++; 00050 // if(countSpace >= 13) 00051 // break; 00052 // if(z[i] == ' ') 00053 // countSpace++; 00054 // } 00055 00056 lcd.printf("\n"); 00057 if(i==141) break; 00058 } 00059 for(i=82;i<141;i++) 00060 { 00061 wait(0.2); 00062 lcd.printf("%c",z[i]); 00063 00064 //lcd.printf("%s",); 00065 wait(0.25); 00066 } 00067 00068 //lcddisp(z); 00069 00070 wait(10); 00071 GSM.printf("AT+CMGD=1\r\n"); 00072 wait(2); 00073 } 00074 00075 00076 //void lcddisp(char *s) 00077 //{ 00078 // int l=strlen(s); 00079 // for(int i=80;i<l;i++) 00080 // { 00081 // lcd.printf("%c",s[i]); 00082 // wait(1); 00083 // } 00084 //} 00085 00086 00087
Generated on Tue Jul 26 2022 03:57:55 by
1.7.2
