A first code example to get you started with the QW (GPS) Shield for SIGFOX development. It provides a serial connection to the modem over usb and transmits a SIGFOX message upon a button press.
HelloWorld QW Development kit
Preloaded code example
The QW development kits ship with this code example. This example allows you to talk straight to the TD1208 modem when using a virtual com port (note: local echo is off). This code-example also sends a SIGFOX message whenever you press a button. The message contains the button number and the measured environment temperature. The first byte is always 0x01.
More information and other example code can be found on the component page by clicking the link below: https://developer.mbed.org/components/QW-SIGFOX-Development-Kit/
Revision 6:ac11cebb397e, committed 2017-03-14
- Comitter:
- quicksand
- Date:
- Tue Mar 14 15:20:26 2017 +0000
- Parent:
- 5:ca670603d63d
- Commit message:
- Code cleanup.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r ca670603d63d -r ac11cebb397e main.cpp --- a/main.cpp Tue Mar 14 15:08:58 2017 +0000 +++ b/main.cpp Tue Mar 14 15:20:26 2017 +0000 @@ -157,9 +157,9 @@ /* Wait untill serial feedback, max 10 seconds before timeout */ tmout.attach(&sertmout, 10.0); int c; - while(!ser_timeout && !ok && !error) - while (modem.readable() && !ser_timeout && !ok && !error) { - c = modem.getc(); + while (!ser_timeout && !ok && !error) { + if(modem.readable()) { + c = modem.getc(); if ( (char)c == *readyStringPtr ) readyStringPtr++; else readyStringPtr = readyString; if ( *readyStringPtr == 0 ) { @@ -171,7 +171,8 @@ error = true; } } + } tmout.detach(); if(ser_timeout) return false; else return ok; - } \ No newline at end of file +} \ No newline at end of file