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.
main.cpp
- Committer:
- Ing_Affinito
- Date:
- 2016-11-13
- Revision:
- 1:5d8c21afbd0e
- Parent:
- 0:0d3364f6d8ec
File content as of revision 1:5d8c21afbd0e:
#include "mbed.h"
#include "gprs.h"
bool no_sms_sended;
bool not_initialized;
int sms_sended;
DigitalOut myled(LED1);
GPRS testgprs(D1,D0,9600,"+393470973841"); //Hardware Serial
//Serial gprs(p9,p10); //Software Serial
Serial pc(USBTX,USBRX);
Timer timeCnt;
int main()
{
not_initialized=true;
no_sms_sended=true;
myled = 1;
wait(2);
myled = 0;
while (not_initialized)
{
myled = 1;
if (testgprs.init()==0);
{
not_initialized=false;
myled = 0;
}
wait(2);
}
//myled = 0; // LED is OFF
/*while (testgprs.checkSIMStatus()!=0)
{
myled = 1;
wait(0.5);
myled = 0;
wait (0.5);
}*/
while (no_sms_sended)
{
myled = 1;
sms_sended=testgprs.sendSMS("+393470973841", "ciao BELLO");
wait(4);
myled = 0;
if (sms_sended==0)
{
no_sms_sended=false;
}
for (int i=0; i<5; i++)
{
myled = 1;
wait(0.5);
myled = 0;
wait (0.5);
}
wait (2);
}
}