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.


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


Verify that the LoraSendAndReceive sketch is loaded into the IDE.


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


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


The Arduino_secrets.h file should look similar to this.


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.


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


    Ensure that both NL & CR are selected.


    Type some text and press ENTER.


    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 !