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 QSL_SimplePublish by
QSL SimplePublish
SmartMesh IP QuickStart Library
- GitHub repository
- Current release used: REL-1.0.2.2
- Documentation
- Discussion
Diff: main.cpp
- Revision:
- 2:f177b47313ba
- Parent:
- 0:d3f5fdf2e6da
- Child:
- 3:fb2c485306d1
--- a/main.cpp Thu Sep 01 15:00:28 2016 +0000
+++ b/main.cpp Fri Sep 02 10:37:54 2016 +0000
@@ -13,8 +13,8 @@
// We can use debug macros from dn_debug, as stdio defaults to this serial
Serial serialDebug(SERIAL_TX, SERIAL_RX);
-// LED1 is the green LED on the NUCLEO-L053R8; might change for other boards
-DigitalOut myled(LED1);
+// LED2 is the green LED on the NUCLEO-L053R8; might change for other boards
+DigitalOut myled(LED2);
static uint16_t randomWalk(void);
static void parsePayload(const uint8_t *payload, uint8_t size);
@@ -24,17 +24,26 @@
uint8_t payload[3];
uint8_t inboxBuf[DN_DEFAULT_PAYLOAD_SIZE_LIMIT];
uint8_t bytesRead;
+ uint8_t i;
serialDebug.baud(115200);
log_info("Initializing...");
dn_qsl_init();
+
+ // Flash LED to indicate start-up complete
+ for (i = 0; i < 10; i++)
+ {
+ myled = !myled;
+ dn_sleep_ms(50);
+ }
while(TRUE) {
if (dn_qsl_isConnected())
{
uint16_t val = randomWalk();
static uint8_t count = 0;
+ myled = 0; // Turn off LED during send/read
dn_write_uint16_t(payload, val);
payload[2] = count;
@@ -54,14 +63,15 @@
parsePayload(inboxBuf, bytesRead);
} while (bytesRead > 0);
+ myled = 1; // Turn on LED
dn_sleep_ms(DATA_PERIOD_MS);
} else
{
log_info("Connecting...");
- myled = 0;
+ myled = 0; // Not connected; turn off LED
if (dn_qsl_connect(NETID, JOINKEY, SRC_PORT, BANDWIDTH_MS))
{
- myled = 1;
+ myled = 1; // Connected; turn on LED
log_info("Connected to network");
} else
{
