Gustavo Ramirez
/
gsmrecibe1
este programa acciona un led con un mensaje de texto "Led verde" y apaga con "Lgeverde" el led azul
Diff: main.cpp
- Revision:
- 1:f21dc295f75c
- Parent:
- 0:f9ce3b274d95
--- a/main.cpp Thu Jan 29 05:24:03 2015 +0000 +++ b/main.cpp Fri Apr 28 15:46:29 2017 +0000 @@ -1,5 +1,6 @@ //programa para celular siemens que recibe un mensaje de texto t activa una salida en formato //pdu hex +//VERSION ABRIL 28-2017 #include "mbed.h" #include "DebouncedIn.h" #include "stdio.h" @@ -32,12 +33,13 @@ char r[]=""; char msg[256]; char char1; +//--------------------------------------------------------------- void FlushGSM(void) { char1 = 0; while (GSM.readable()){ char1 = GSM.getc();} return;} - +//---------------------------------------------------------------- void callback() { pc.printf("%c\n", GSM.getc()); @@ -68,14 +70,14 @@ } return 0; } - +//------------------------------------------------------------------------ void cleanBuffer(char *buffer, int count) { for(int i=0; i < count; i++) { buffer[i] = '\0'; } } - +//---------------------------------------------------------------------- void sendCmd(char *cmd) { GSM.puts(cmd); @@ -107,18 +109,18 @@ return 0; } - +//---------------------------------------------------------------------------- int sendCmdAndWaitForResp(char *cmd, char *resp, int timeout) { sendCmd(cmd); return waitForResp(resp,timeout); } - +//--------------------------------------------------------------------------- int powerCheck(void) { return sendCmdAndWaitForResp("AT\r\n", "OK", 2); } - +//---------------------------------------------------------------------------- int checkSIMStatus(void) { char gprsBuffer[30]; @@ -139,7 +141,7 @@ } return 0; } - +//-------------------------------------------------------------------------------------------------- int checkSignalStrength(void) { char gprsBuffer[100]; @@ -159,7 +161,7 @@ } return index; } - +//---------------------------------------------------------------------------------------- int init() { for(int i = 0; i < 3; i++){ @@ -176,7 +178,7 @@ GSM.attach(&Rx_interrupt, Serial::RxIrq); return 0; } - +//------------------------------------------------------------------------------------------------- int readSMSpdu(char *message, int index) { int i = 0; @@ -197,7 +199,7 @@ } return 0; } - +//----------------------------------------------------------------------------------- int deleteSMS(int index) { char cmd[32]; @@ -205,7 +207,7 @@ sendCmd(cmd); return 0; } - +//--------------------------------------------------------------------------------------------- void Rx_interrupt(){ } @@ -230,10 +232,7 @@ GSM.printf("CBST=0,0,1\r\n"); wait(0.5); LedVerde=0; - - - - +//------------------El Ciclico---------------------------------------- while(1){ @@ -246,7 +245,8 @@ GSM.printf("AT+CMGS=%d\r\n",index); wait(0.2); - GSM.printf("0011000A9113613102650000AA08416650DA0C8262"); + // onverde= 0011000A9113223717370000AA076FB7BD2C279701 + GSM.printf("0011000A9113223717370000AA076FB7BD2C279701"); wait(0.5); GSM.putc((char)0x1A); LedVerde=1; @@ -291,3 +291,29 @@ } } } +/* +cadena real --Led verde= 0011000A9113223717370000AA09CC3219642FCBC965 +esto llega luego de mandar -------------------Led verde---------------- +buffer= + + buffer= [00] [00] + + buffer= $$+CMTI: "SM",1$$ + + buffer= S M + + buffer1= +CMTI + + AT+CMGL=0 + +buffer= $$+CMGL: 1,0,,26$$0791751330512411040AA1132237173700007140820173340A09CC3219642FCBC965$$$$OK$$ + + buffer= , 0 + + mensaje= $$+CMGL: 1,0,,26$$0791751330512411040AA1132237173700007140820173340A09CC3219642FCBC965 + + mensaje[72]= 3 mensaje[73]=2 + + + +*/ \ No newline at end of file