gowrishankar N J
/
perfectgsm_send
msg_recieve
Fork of gsm by
main.cpp@0:fdee2188ee70, 2014-04-28 (annotated)
- Committer:
- hemanthagowda
- Date:
- Mon Apr 28 12:14:03 2014 +0000
- Revision:
- 0:fdee2188ee70
- Child:
- 1:cb32bdc1dc7c
gsm_message;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hemanthagowda | 0:fdee2188ee70 | 1 | #include "mbed.h" |
hemanthagowda | 0:fdee2188ee70 | 2 | char a=0x1A,e=0x22,c=0x0d; |
hemanthagowda | 0:fdee2188ee70 | 3 | char num[] = "9740647273"; |
hemanthagowda | 0:fdee2188ee70 | 4 | DigitalOut myled(LED1); |
hemanthagowda | 0:fdee2188ee70 | 5 | char *rec[]; |
hemanthagowda | 0:fdee2188ee70 | 6 | |
hemanthagowda | 0:fdee2188ee70 | 7 | int i; |
hemanthagowda | 0:fdee2188ee70 | 8 | char* txt; |
hemanthagowda | 0:fdee2188ee70 | 9 | Serial GSM(p9, p10,txt); // tx, rx |
hemanthagowda | 0:fdee2188ee70 | 10 | Serial pc(USBTX,USBRX); |
hemanthagowda | 0:fdee2188ee70 | 11 | |
hemanthagowda | 0:fdee2188ee70 | 12 | //////////////////////////////////////////////////////////////////// |
hemanthagowda | 0:fdee2188ee70 | 13 | // fun() - it reads the sensor, writes to LCD and SD card and also senda the data on GSM |
hemanthagowda | 0:fdee2188ee70 | 14 | //////////////////////////////////////////////////////////////////// |
hemanthagowda | 0:fdee2188ee70 | 15 | /* |
hemanthagowda | 0:fdee2188ee70 | 16 | int main() |
hemanthagowda | 0:fdee2188ee70 | 17 | { |
hemanthagowda | 0:fdee2188ee70 | 18 | |
hemanthagowda | 0:fdee2188ee70 | 19 | // GSM.printf("AT+CMGS=%c%s%c\r\n",e,num,e); |
hemanthagowda | 0:fdee2188ee70 | 20 | GSM.printf("AT\r\n"); |
hemanthagowda | 0:fdee2188ee70 | 21 | wait(5); |
hemanthagowda | 0:fdee2188ee70 | 22 | // GSM.printf("ATD9620129820;\r\n"); |
hemanthagowda | 0:fdee2188ee70 | 23 | //pc.printf("9620129820;\r\n"); |
hemanthagowda | 0:fdee2188ee70 | 24 | //wait(10); |
hemanthagowda | 0:fdee2188ee70 | 25 | //GSM.printf("ATH\n"); |
hemanthagowda | 0:fdee2188ee70 | 26 | //GSM.printf("Moisture"); |
hemanthagowda | 0:fdee2188ee70 | 27 | //GSM.printf("%c",a); |
hemanthagowda | 0:fdee2188ee70 | 28 | return 0; |
hemanthagowda | 0:fdee2188ee70 | 29 | }*/ |
hemanthagowda | 0:fdee2188ee70 | 30 | |
hemanthagowda | 0:fdee2188ee70 | 31 | int main() |
hemanthagowda | 0:fdee2188ee70 | 32 | { |
hemanthagowda | 0:fdee2188ee70 | 33 | |
hemanthagowda | 0:fdee2188ee70 | 34 | GSM.baud(9600); |
hemanthagowda | 0:fdee2188ee70 | 35 | pc.baud(9600); |
hemanthagowda | 0:fdee2188ee70 | 36 | GSM.printf("AT\r\n"); |
hemanthagowda | 0:fdee2188ee70 | 37 | wait(2); |
hemanthagowda | 0:fdee2188ee70 | 38 | GSM.printf("AT+CMGF=1\r\n"); |
hemanthagowda | 0:fdee2188ee70 | 39 | wait(2); |
hemanthagowda | 0:fdee2188ee70 | 40 | GSM.scanf("%d",&i); |
hemanthagowda | 0:fdee2188ee70 | 41 | while(1) |
hemanthagowda | 0:fdee2188ee70 | 42 | { |
hemanthagowda | 0:fdee2188ee70 | 43 | wait(3); |
hemanthagowda | 0:fdee2188ee70 | 44 | |
hemanthagowda | 0:fdee2188ee70 | 45 | |
hemanthagowda | 0:fdee2188ee70 | 46 | //GSM.printf("ATD9742920934;%c\n",c); |
hemanthagowda | 0:fdee2188ee70 | 47 | GSM.printf("AT+CMGS=%c%s%c\r\n",e,num,e); |
hemanthagowda | 0:fdee2188ee70 | 48 | wait(2); |
hemanthagowda | 0:fdee2188ee70 | 49 | // pc.printf("AT+CMGS=%c%s%c%c\n",e,num,e,c); |
hemanthagowda | 0:fdee2188ee70 | 50 | //pc.printf("ATD9538765141;%c\n",c); |
hemanthagowda | 0:fdee2188ee70 | 51 | GSM.printf("Moisture\n\r"); |
hemanthagowda | 0:fdee2188ee70 | 52 | |
hemanthagowda | 0:fdee2188ee70 | 53 | // pc.printf("Moisture\n"); |
hemanthagowda | 0:fdee2188ee70 | 54 | GSM.printf("%c",a); |
hemanthagowda | 0:fdee2188ee70 | 55 | // pc.printf("%c",a);*/ |
hemanthagowda | 0:fdee2188ee70 | 56 | /* GSM.printf("AT+CMGR=28\r\n"); |
hemanthagowda | 0:fdee2188ee70 | 57 | wait(2); |
hemanthagowda | 0:fdee2188ee70 | 58 | GSM.scanf("%s",txt); |
hemanthagowda | 0:fdee2188ee70 | 59 | if(*txt=='REC') |
hemanthagowda | 0:fdee2188ee70 | 60 | { |
hemanthagowda | 0:fdee2188ee70 | 61 | myled=1; |
hemanthagowda | 0:fdee2188ee70 | 62 | } |
hemanthagowda | 0:fdee2188ee70 | 63 | wait(1); |
hemanthagowda | 0:fdee2188ee70 | 64 | } |
hemanthagowda | 0:fdee2188ee70 | 65 | */ |
hemanthagowda | 0:fdee2188ee70 | 66 | |
hemanthagowda | 0:fdee2188ee70 | 67 | } |
hemanthagowda | 0:fdee2188ee70 | 68 | } |