Step 11 - Send and Receive LoRaWAN® Packets

In this step, you will:

– Use the LoraSendAndReceive sketch.

– Edit Arduino_secrets.h to enter the device credentials that you had decided on in Step 10.

– Run the sketch to observe that your LoRaWAN® packet is sent to TPC.

Now, your environment is ready to send your first LoRaWAN® packet is sent to TPC. For this purpose, you are going to use the example(*) sketch supplied by the MKRWAN library.

In order to be able to receive and view the LoRaWAN® packets that you send with your device, it should be registered with TPC.

1

Select the LoRaSendAndReceive sketch supplied by the MKRWAN library, which can be found under the Examples menu of the Files main menu.

2

Verify that the LoraSendAndReceive sketch is loaded into the IDE.

3

Edit the Arduino_secrets.h file by clicking on the second tab in the IDE.

4

Replace “xxxxxxxxxxxxxxxx” by the JoinEUI  and “yyyyyyyyyyyyyyyy” with the AppKey that you chose in Step 10.

5

The Arduino_secrets.h file should look similar to this.

6

Select upload by clicking on the arrow, or alternatively, you can use ctrl+U for sketches to:

  • Compile
  • Upload to Device
  • Run
  • 7

    Observe the CPU reset message that shows that your sketch has been compiled, uploaded, and started to run on your device.

    8

    Click the Serial Monitor icon to view the messages printed by the device as a result of the run.

    9

    Ensure that both NL & CR are selected.

    10

    Type some text and press ENTER.

    11

    If you see Message sent correctly!, it means the following:

    – Your sketch is compiled and uploaded to the device. i.e., your IDE is working perfectly.

    -Your LoRaWAN® packet was delivered correctly i.e., your packet arrived at TPC, your TPC definitions are correct, and as a result, your packet was accepted by TPC.

    As a result of this step, it is confirmed that all the steps of this activity have been successfully performed. Congratulations !

    * https://docs.arduino.cc/tutorials/mkr-wan-1310/mkr-wan-library-examples#mkr-wan-lora-send-and-receive