summaryrefslogtreecommitdiff
path: root/nrfdemo/README.rst
blob: a76ecd46fb9a2f783490c06d3d7428df52015815 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

MQTT: Read and control device over MQTT Protocol
####################################################################################

Description
***********

This sample application shows how to use the MQTT protocol and library to connect to an MQTT 
broker and send data back and forth to another MQTT client to remotely control 
the LEDs and monitor the status of buttons on your Stratus board.

When button 1/ Mode button is pressed on the board, the message “Hello from Conexio Stratus DK” is 
published to `CONFIG_MQTT_PUB_TOPIC`, and any client subscribed to this topic will receive this message.

On the other hand, when the `LEDON` message is sent from another client to the `CONFIG_MQTT_SUB_TOPIC`
topic, the Blue LED on the board is turned ON. When the `LEDOFF` message is sent from another client to the 
`CONFIG_MQTT_SUB_TOPIC`` topic, the LED is turned OFF.


Building and Running
********************

For the Stratus Pro nrf9151/nRF9161 device, the west build command is: 

   west build -b conexio_stratus_pro/nrf9161/ns -- -DBOARD_ROOT=/opt/nordic/ncs/v2.7.0/conexio-firmware-sdk

For the Stratus nRF9160 device, the build command is:

   west build -b conexio_stratus/nrf9160/ns -- -DBOARD_ROOT=/opt/nordic/ncs/v2.7.0/conexio-firmware-sdk

Flash the compiled firmware using `newtmgr` to the Stratus DK

   newtmgr -c serial image upload build/zephyr/app_update.bin


Sample Output
=============

.. code-block:: console

      *** Booting nRF Connect SDK v3.5.99-ncs1 ***
      [00:00:00.250,854] <inf> MQTT: Starting MQTT sample on conexio_stratus_pro
      [00:00:00.250,885] <inf> MQTT: Initializing modem library
      [00:00:00.488,494] <inf> MQTT: Connecting to LTE network
      [00:01:09.398,864] <inf> MQTT: RRC mode: Connected
      [00:01:11.441,558] <inf> MQTT: Network registration status: Connected - roaming
      [00:01:11.441,711] <inf> MQTT: Connected to LTE network
      [00:01:11.696,868] <inf> MQTT: IPv4 Address found 91.121.93.94
      [00:01:12.195,983] <inf> MQTT: MQTT client connected
      [00:01:12.196,014] <inf> MQTT: Subscribing to: stratus/sub/topic len 17
      [00:01:12.509,826] <inf> MQTT: SUBACK packet id: 1234
      [00:01:16.851,287] <inf> MQTT: RRC mode: Idle
      [00:01:52.350,280] <inf> MQTT: RRC mode: Connected
      [00:01:52.467,407] <inf> MQTT: MQTT PUBLISH result=0 len=6
      [00:01:52.467,895] <inf> MQTT: Received: LEDOFF
      [00:01:56.277,648] <inf> MQTT: RRC mode: Idle
      [00:02:01.310,577] <inf> MQTT: RRC mode: Connected
      [00:02:01.426,727] <inf> MQTT: MQTT PUBLISH result=0 len=5
      [00:02:01.427,185] <inf> MQTT: Received: LEDON
      [00:02:05.244,934] <inf> MQTT: RRC mode: Idle
      [00:02:12.820,953] <inf> MQTT: RRC mode: Connected
      [00:02:12.947,113] <inf> MQTT: MQTT PUBLISH result=0 len=6
      [00:02:12.947,570] <inf> MQTT: Received: LEDOFF
      [00:02:16.627,197] <inf> MQTT: RRC mode: Idle

Credit 
===============
Nordic Semiconductor