shirley akhila
/
aaa
gsm1
Fork of GSM by
main.cpp@2:9a9fa2279b8e, 2014-05-05 (annotated)
- Committer:
- shirley
- Date:
- Mon May 05 14:35:06 2014 +0000
- Revision:
- 2:9a9fa2279b8e
- Parent:
- 1:641050920d1e
aaa
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
HarishMekali | 0:2a5254679d16 | 1 | #include "mbed.h" |
gowrishankarnj | 1:641050920d1e | 2 | #include "Serial.h" |
shirley | 2:9a9fa2279b8e | 3 | #include "TextLCD.h" |
shirley | 2:9a9fa2279b8e | 4 | #include "cstring" |
gowrishankarnj | 1:641050920d1e | 5 | DigitalOut myled(LED1); |
shirley | 2:9a9fa2279b8e | 6 | TextLCD lcd(p19, p20, p21, p22, p23, p24); |
HarishMekali | 0:2a5254679d16 | 7 | char a=0x1A,e=0x22,c=0x0d; |
gowrishankarnj | 1:641050920d1e | 8 | //char a=0x1A,e=0x22,c=0x0d; |
gowrishankarnj | 1:641050920d1e | 9 | //char num[] = "9740647273"; |
gowrishankarnj | 1:641050920d1e | 10 | |
HarishMekali | 0:2a5254679d16 | 11 | |
gowrishankarnj | 1:641050920d1e | 12 | //char *txt; |
gowrishankarnj | 1:641050920d1e | 13 | |
gowrishankarnj | 1:641050920d1e | 14 | Serial GSM(p9,p10); // tx, rx |
HarishMekali | 0:2a5254679d16 | 15 | Serial pc(USBTX,USBRX); |
shirley | 2:9a9fa2279b8e | 16 | void lcddisp(char *s); |
HarishMekali | 0:2a5254679d16 | 17 | |
gowrishankarnj | 1:641050920d1e | 18 | char sm[3]="SM"; |
gowrishankarnj | 1:641050920d1e | 19 | char all[4]="ALL"; |
shirley | 2:9a9fa2279b8e | 20 | char *s; |
shirley | 2:9a9fa2279b8e | 21 | char *p='\0'; |
shirley | 2:9a9fa2279b8e | 22 | int countSpace=0; |
HarishMekali | 0:2a5254679d16 | 23 | |
gowrishankarnj | 1:641050920d1e | 24 | int main() |
gowrishankarnj | 1:641050920d1e | 25 | { |
gowrishankarnj | 1:641050920d1e | 26 | GSM.baud(9600); |
gowrishankarnj | 1:641050920d1e | 27 | pc.baud(9600); |
shirley | 2:9a9fa2279b8e | 28 | char z[141]; |
shirley | 2:9a9fa2279b8e | 29 | int i=0; |
shirley | 2:9a9fa2279b8e | 30 | |
shirley | 2:9a9fa2279b8e | 31 | |
shirley | 2:9a9fa2279b8e | 32 | |
shirley | 2:9a9fa2279b8e | 33 | |
shirley | 2:9a9fa2279b8e | 34 | |
shirley | 2:9a9fa2279b8e | 35 | GSM.printf("AT+CMGR=1\r\r"); |
gowrishankarnj | 1:641050920d1e | 36 | //wait(2); |
shirley | 2:9a9fa2279b8e | 37 | //lcd.printf("\n"); |
shirley | 2:9a9fa2279b8e | 38 | |
gowrishankarnj | 1:641050920d1e | 39 | while(1) |
shirley | 2:9a9fa2279b8e | 40 | |
gowrishankarnj | 1:641050920d1e | 41 | { |
shirley | 2:9a9fa2279b8e | 42 | while(!GSM.readable()) |
shirley | 2:9a9fa2279b8e | 43 | {}; |
shirley | 2:9a9fa2279b8e | 44 | |
shirley | 2:9a9fa2279b8e | 45 | //do{ |
gowrishankarnj | 1:641050920d1e | 46 | // pc.printf("aaa"); |
shirley | 2:9a9fa2279b8e | 47 | |
gowrishankarnj | 1:641050920d1e | 48 | GSM.scanf("%c",&z[i]); |
gowrishankarnj | 1:641050920d1e | 49 | i++; |
shirley | 2:9a9fa2279b8e | 50 | // if(countSpace >= 13) |
shirley | 2:9a9fa2279b8e | 51 | // break; |
shirley | 2:9a9fa2279b8e | 52 | // if(z[i] == ' ') |
shirley | 2:9a9fa2279b8e | 53 | // countSpace++; |
shirley | 2:9a9fa2279b8e | 54 | // } |
shirley | 2:9a9fa2279b8e | 55 | |
shirley | 2:9a9fa2279b8e | 56 | lcd.printf("\n"); |
shirley | 2:9a9fa2279b8e | 57 | if(i==141) break; |
gowrishankarnj | 1:641050920d1e | 58 | } |
shirley | 2:9a9fa2279b8e | 59 | for(i=82;i<141;i++) |
shirley | 2:9a9fa2279b8e | 60 | { |
shirley | 2:9a9fa2279b8e | 61 | wait(0.2); |
shirley | 2:9a9fa2279b8e | 62 | lcd.printf("%c",z[i]); |
shirley | 2:9a9fa2279b8e | 63 | |
shirley | 2:9a9fa2279b8e | 64 | //lcd.printf("%s",); |
shirley | 2:9a9fa2279b8e | 65 | wait(0.25); |
shirley | 2:9a9fa2279b8e | 66 | } |
shirley | 2:9a9fa2279b8e | 67 | |
shirley | 2:9a9fa2279b8e | 68 | //lcddisp(z); |
shirley | 2:9a9fa2279b8e | 69 | |
shirley | 2:9a9fa2279b8e | 70 | wait(10); |
shirley | 2:9a9fa2279b8e | 71 | GSM.printf("AT+CMGD=1\r\n"); |
shirley | 2:9a9fa2279b8e | 72 | wait(2); |
shirley | 2:9a9fa2279b8e | 73 | } |
shirley | 2:9a9fa2279b8e | 74 | |
shirley | 2:9a9fa2279b8e | 75 | |
shirley | 2:9a9fa2279b8e | 76 | //void lcddisp(char *s) |
shirley | 2:9a9fa2279b8e | 77 | //{ |
shirley | 2:9a9fa2279b8e | 78 | // int l=strlen(s); |
shirley | 2:9a9fa2279b8e | 79 | // for(int i=80;i<l;i++) |
shirley | 2:9a9fa2279b8e | 80 | // { |
shirley | 2:9a9fa2279b8e | 81 | // lcd.printf("%c",s[i]); |
shirley | 2:9a9fa2279b8e | 82 | // wait(1); |
shirley | 2:9a9fa2279b8e | 83 | // } |
shirley | 2:9a9fa2279b8e | 84 | //} |
shirley | 2:9a9fa2279b8e | 85 | |
shirley | 2:9a9fa2279b8e | 86 | |
gowrishankarnj | 1:641050920d1e | 87 |