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/
Diff: main.cpp
- Revision:
- 5:ca670603d63d
- Parent:
- 4:69df63eeb91e
- Child:
- 6:ac11cebb397e
--- a/main.cpp Tue Mar 14 14:54:35 2017 +0000 +++ b/main.cpp Tue Mar 14 15:08:58 2017 +0000 @@ -23,7 +23,6 @@ bool modem_command_check_ok(char * command); void modem_setup(); void txData(uint8_t btn); - bool ser_timeout = false; Ticker heartbeat; @@ -159,20 +158,20 @@ tmout.attach(&sertmout, 10.0); int c; while(!ser_timeout && !ok && !error) - if(modem.readable()) - while (((c = modem.getc()) > 0) && !ser_timeout && !ok && !error) { - if ( (char)c == *readyStringPtr ) readyStringPtr++; - else readyStringPtr = readyString; - if ( *readyStringPtr == 0 ) { - ok = true; - } - if ( (char)c == *errorStringPtr ) errorStringPtr++; - else errorStringPtr = errorString; - if ( *errorStringPtr == 0 ) { - error = true; - } + while (modem.readable() && !ser_timeout && !ok && !error) { + c = modem.getc(); + if ( (char)c == *readyStringPtr ) readyStringPtr++; + else readyStringPtr = readyString; + if ( *readyStringPtr == 0 ) { + ok = true; } + if ( (char)c == *errorStringPtr ) errorStringPtr++; + else errorStringPtr = errorString; + if ( *errorStringPtr == 0 ) { + error = true; + } + } tmout.detach(); if(ser_timeout) return false; else return ok; -} \ No newline at end of file + } \ No newline at end of file