Example project to publish messages to a MQTT-SN broker using the u-blox SARA-N200 NB-IoT modem
Dependencies: MQTTSNPacket X-NUCLEO-SARA-N200
Diff: README.md
- Revision:
- 12:9a2dab9b927d
- Parent:
- 0:c0cf12ee5420
--- a/README.md Wed Aug 22 14:45:57 2018 +0000 +++ b/README.md Thu Aug 23 11:32:34 2018 +0200 @@ -1,6 +1,6 @@ -# Getting started with Blinky on mbed OS +# Getting started with Hello MQTT-SN -This guide reviews the steps required to get Blinky working on an mbed OS platform. +This guide reviews the steps required to use the MQTT-SN example on an mbed OS platform. Please install [mbed CLI](https://github.com/ARMmbed/mbed-cli#installing-mbed-cli). @@ -9,39 +9,58 @@ From the command-line, import the example: ``` -mbed import mbed-os-example-blinky -cd mbed-os-example-blinky +mbed import sara-n200-hello-mqtt-sn +cd sara-n200-hello-mqtt-sn ``` +### Configure the MQTT-SN broker +Edit the mbed_app.json: +``` + "topic": "\"nucleo\"", + "mqtt_sn_host": "\"160.119.253.14\"", + "mqtt_sn_port": "10000" +``` +Set the host (do not forget the escaped Quotation marks), port and topic to which your node will connect to + ### Now compile Invoke `mbed compile`, and specify the name of your platform and your favorite toolchain (`GCC_ARM`, `ARM`, `IAR`). For example, for the ARM Compiler 5: ``` -mbed compile -m K64F -t ARM +mbed compile -m NUCLEO_F411RE -t GCC_ARM ``` Your PC may take a few minutes to compile your code. At the end, you see the following result: ``` [snip] -+----------------------------+-------+-------+------+ -| Module | .text | .data | .bss | -+----------------------------+-------+-------+------+ -| Misc | 13939 | 24 | 1372 | -| core/hal | 16993 | 96 | 296 | -| core/rtos | 7384 | 92 | 4204 | -| features/FEATURE_IPV4 | 80 | 0 | 176 | -| frameworks/greentea-client | 1830 | 60 | 44 | -| frameworks/utest | 2392 | 512 | 292 | -| Subtotals | 42618 | 784 | 6384 | -+----------------------------+-------+-------+------+ -Allocated Heap: unknown -Allocated Stack: unknown -Total Static RAM memory (data + bss): 7168 bytes -Total RAM memory (data + bss + heap + stack): 7168 bytes -Total Flash memory (text + data + misc): 43402 bytes -Image: .\.build\K64F\ARM\mbed-os-example-blinky.bin ++-----------------------------------------+-------+-------+------+ +| Module | .text | .data | .bss | ++-----------------------------------------+-------+-------+------+ +| MQTTSNPacket/MQTTSNConnectClient.o | 274 | 0 | 0 | +| MQTTSNPacket/MQTTSNDeserializePublish.o | 390 | 0 | 0 | +| MQTTSNPacket/MQTTSNPacket.o | 280 | 0 | 0 | +| MQTTSNPacket/MQTTSNSerializePublish.o | 460 | 0 | 0 | +| MQTTSNPacket/MQTTSNSubscribeClient.o | 304 | 0 | 0 | +| X-NUCLEO-SARA-N200/sara-n2.o | 2018 | 0 | 0 | +| [fill] | 172 | 4 | 18 | +| [lib]/c.a | 42290 | 2472 | 89 | +| [lib]/gcc.a | 3392 | 0 | 0 | +| [lib]/misc | 252 | 16 | 28 | +| main.o | 3531 | 52 | 2099 | +| mbed-os/drivers | 3774 | 4 | 100 | +| mbed-os/features | 16 | 0 | 0 | +| mbed-os/hal | 1697 | 4 | 68 | +| mbed-os/platform | 6218 | 260 | 345 | +| mbed-os/rtos | 9058 | 168 | 6081 | +| mbed-os/targets | 8114 | 4 | 900 | +| Subtotals | 82240 | 2984 | 9728 | ++-----------------------------------------+-------+-------+------+ +Total Static RAM memory (data + bss): 12712 bytes +Total Flash memory (text + data): 85224 bytes + +Image: ./BUILD/NUCLEO_F411RE/GCC_ARM/sara-n200-hello-mqtt-sn.bin + ``` ### Program your board @@ -51,6 +70,7 @@ 1. Press the reset button to start the program. The LED on your platform turns on and off. +Open a terminal to see debug information. ## Troubleshooting