utils/consoleLoRa.h provides the following functions (from the MKRWAN library) to your console application:

  • s_console_lora_config_cmds() : which delivers the following commands
    • lora info – prints all current LoRa settings and infos
    • lora set_devaddr <x> – edit the LoRa device address 4 bytes[hex]
    • lora set_nwkskey <x> – edit the network session key 16 bytes[hex]
    • lora set_appskey <x> – edit the application session key 16 bytes[hex]
    • lora set_appeui <x> – edit the app EUI 8 bytes[hex]
    • lora set_appkey <x> – edit the app key 16 bytes[hex]
    • lora factory_reset <x> – defaults the radio parameters of the module

The s_console_lora_config_cmds() function and the commands that it provides can be used to allow the user of your application to configure the dice-LoRa device for the LoRaWAN network. The setting will be stored in the bootloader protected area of the processor memory.

  • s_console_lora_cmds() : provides the following evaluation and testing commands
    • lora joinOTAA – try to join the network via over the air update (OTA)
    • lora joinABP – try to join the network via activation by personalisation (ABP)
    • lora send <port> <x> – Send data(string) on port to the lora network
    • lora sendCnf <port> <x> – Send confirmed data(string) on port to the lora network
    • lora reset – pulls reset pin of the lora module

The s_console_lora_cmds() function is mainly for testing, learning and evaluation purposes.


String s_console_string – String that holds the user command. Normally returned by s_console_routine() or a previous console function.


String : the user command or an empty String “” if the user command was recognised and processed by this function. (see of commands above)

Example Code:

#include "consoleLogin.h"
#include "utils/consoleLoRa.h"

void setup() {
void loop() {
  String s_console_string = s_console_routine();  
  s_console_string = s_console_lora_config_cmds(s_console_string);

Notes and Warnings

This console-function and its commands are helpful to test and learn to work with the MKRWAN library. See the source code as example code for your own application:


In a ‘real world’ application, the s_console_lora_cmds() should not be required but during development it could be helpful to test the MKRWAN library.

Hint: Also use The Things Network account to test and set up a LoRaWAN communication application.

Please keep in mind that each included file and its used function increase the size of the resulting application. So in order to keep the application binaries as small as possible, include only functions that are really necessary for the final application.

An example can be found in the Arduino IDE menu:
File -> Examples -> Consoles -> Dev_Console

See also

The Things Network
MKRWAN library