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.
Fork of Geofence_sender by
Revision 2:c1f0b54834a5, committed 2016-01-01
- Comitter:
- afahadshujah
- Date:
- Fri Jan 01 19:31:35 2016 +0000
- Parent:
- 1:93cb484f564a
- Commit message:
- Geofencer Fahad;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 93cb484f564a -r c1f0b54834a5 main.cpp --- a/main.cpp Thu Dec 31 16:33:07 2015 +0000 +++ b/main.cpp Fri Jan 01 19:31:35 2016 +0000 @@ -19,10 +19,11 @@ // send messages forever -void send_loop() { +int send_loop() { uint8_t data[32] = ""; + int flagcheck1=0; - while (1) { + while (flagcheck1==0) { if(af.sample()==1) { @@ -34,10 +35,12 @@ pc.printf("\n\rStart sending ... "); if (rf22.sendtoWait(data, sizeof(data), receiver_adress)) { pc.printf("Send to %i ACK: >>%s<< ", receiver_adress,(char*)data); - } else { + } + else { pc.printf("Send to %i NOTACK: >>%s<< ", receiver_adress,(char*)data); } pc.printf("sleeping 2 seconds... "); + flagcheck1=1; wait(1); } else @@ -49,10 +52,8 @@ } // Wait 2 Seconds } } - -int main() { - - pc.baud(9600); + void rfcheck() + { pc.printf("\n\rConnected to mbed\n\r"); pc.printf ("RF22-Test-Reliable-Send V1.0\n\r"); @@ -71,7 +72,13 @@ // Code for sending pc.printf("I am sending with address %i to adress %i ...\n\r",sender_adress,receiver_adress ); rf22.setThisAddress(sender_adress); // sender-adress + + } +int main() { + pc.baud(9600); + rfcheck(); + send_loop(); // start sending } \ No newline at end of file