GPRS

envio_tramas.cpp

Committer:
acafa
Date:
2016-09-11
Revision:
0:d0172354f941

File content as of revision 0:d0172354f941:

#include "mbed.h"

Serial gprs(USBTX, USBRX);
Timer t;
DigitalOut led1(LED1);
int main() 
{
    gprs.baud(115200);
    gprs.format(8,Serial::None,1);
    while(1)
    {
//    t.start();
//    pc.printf("Hello World! @9600kbps\n",1285);
//    t.stop();
//    pc.printf("The time taken was %f seconds\n", t.read());
//    t.reset();



     	wait_ms(500);
    	gprs.printf("ATV1\r\n");
    	wait_ms(500);
    	gprs.printf("AT+CMEE=%d\r\n",2);
    	wait_ms(500);
    	gprs.printf("AT+CPIN?\r\n");
    	wait_ms(500);
    	gprs.printf("AT+CSQ\r\n");
    	wait_ms(500);
    	gprs.printf("AT+CREG?\r\n");
    	wait_ms(500);
    	gprs.printf("AT+QIMODE=%d\r\n",0);
    	wait_ms(500);
    	gprs.printf("AT+QICSGP=1","igprs.claro.com.ar\r\n");
    	wait_ms(500);
       	gprs.printf("AT+QIREGAPP\r\n");
    	wait_ms(500);
    	gprs.printf("AT+QIACT\r\n");
    	wait_ms(500);
    	gprs.printf("AT+QILOCIP\r\n");
    	wait_ms(500);
    	gprs.printf("AT+QIDNSIP=%d\r\n",0);
    	wait_ms(500);
    	gprs.printf("AT+QIOPEN=\"UDP\",\"24.232.33.179\",2502\r\n");
    	wait_ms(500);
    	gprs.printf("AT+QISEND\r\n");
    	wait_ms(500);
    	gprs.printf("LELE PUTO\r\n");
    	wait_ms(500);
    	gprs.printf("1A\r\n");

        wait(1.0);
        led1 = !led1;
    }
}