Arduino : lmic_SelectSubBand was not declared

Discussion on how to get started with various type of IoT projects

Arduino : lmic_SelectSubBand was not declared

Postby Erna Erliyana » Fri Feb 23, 2018 8:01 pm

Hi, I meet a problem when following steps in ... 0-minutes/ until step for "Arduino IDE basic setups for LoRa Node". The Arduino software shows the result that lmic_SelectSubBand was not declared. Below is coding:

// IBM LMIC framework - Version: Latest
#include <lmic.h>

// DHT_sensor_library_master - Version: Latest
#include <DHT.h>
#include <DHT_U.h>

#include <hal/hal.h>
#include <SPI.h>

// LoRaWAN NwkSKey, network session key
static const PROGMEM u1_t NWKSKEY[16] = { 0xEB, 0xED, 0x8E, 0x31, 0x78, 0x37, 0x18, 0xCC, 0xE6, 0x08, 0x5E, 0x48, 0x0B, 0x65, 0x6D, 0x86 };

// LoRaWAN AppSKey, application session key
static const u1_t PROGMEM APPSKEY[16] = { 0x82, 0x87, 0xB0, 0x91, 0x7D, 0x9C, 0xAE, 0xB1, 0xE2, 0x44, 0xDC, 0xFE, 0xA9, 0x42, 0x36, 0x86 };

// LoRaWAN end-device address (DevAddr)
static const u4_t DEVADDR = { 0x260316A5 };

// These callbacks are only used in over-the-air activation, so they are
// left empty here (we cannot leave them out completely unless
// DISABLE_JOIN is set in config.h, otherwise the linker will complain).
void os_getArtEui (u1_t* buf) { }
void os_getDevEui (u1_t* buf) { }
void os_getDevKey (u1_t* buf) { }

static uint8_t mydata[] = "HI,Lora World!";
static osjob_t sendjob;

// Schedule data trasmission in every this many seconds (might become longer due to duty
// cycle limitations).
// we set 10 seconds interval
const unsigned TX_INTERVAL = 10;

// Pin mapping according to Cytron LoRa Shield RFM
const lmic_pinmap lmic_pins = {
.nss = 10,
.rst = 7,
.dio = {2, 5, 6},

void onEvent (ev_t ev) {
Serial.print(": ");
switch(ev) {
Serial.println(F("EV_TXCOMPLETE (includes waiting for RX windows)"));
// Schedule next transmission
os_setTimedCallback(&sendjob, os_getTime()+sec2osticks(TX_INTERVAL), do_send);
Serial.println(F("Unknown event"));

void do_send(osjob_t* j){
// Check if there is not a current TX/RX job running
if (LMIC.opmode & OP_TXRXPEND) {
Serial.println(F("OP_TXRXPEND, not sending"));
} else {
// Prepare upstream data transmission at the next possible time.
LMIC_setTxData2(1, mydata, sizeof(mydata)-1, 0);
Serial.println(F("Packet queued"));
// Next TX is scheduled after TX_COMPLETE event.

void setup() {

// LMIC init

// Reset the MAC state. Session and pending data transfers will be discarded.

// Set static session parameters. Instead of dynamically establishing a session
// by joining the network, precomputed session parameters are be provided.
uint8_t appskey[sizeof(APPSKEY)];
uint8_t nwkskey[sizeof(NWKSKEY)];
memcpy_P(appskey, APPSKEY, sizeof(APPSKEY));
memcpy_P(nwkskey, NWKSKEY, sizeof(NWKSKEY));
LMIC_setSession (0x1, DEVADDR, nwkskey, appskey);

// Select frequencies range

// Disable link check validation

// TTN uses SF9 for its RX2 window.
LMIC.dn2Dr = DR_SF9;

// Set data rate and transmit power for uplink (note: txpow seems to be ignored by the library)

// Start job

void loop() {

It shows this error:
error: 'LMIC_selectSubBand' was not declared in this scope



exit status 1

What can I do to solve it? I am using LoRa RFM Shield + Arduino Uno R3 + Sensor DHT 22 for LoRa Node.
Erna Erliyana
Posts: 2
Joined: Fri Feb 23, 2018 7:24 pm

Re: Arduino : lmic_SelectSubBand was not declared

Postby bengchet » Sun Feb 25, 2018 11:43 pm


Are you downloading from our Github? This library is modified according to tutorial and will not have the issue as stated.
Posts: 237
Joined: Tue Aug 25, 2015 8:29 am

Re: Arduino : lmic_SelectSubBand was not declared

Postby Erna Erliyana » Tue Feb 27, 2018 8:17 am

Hi, thank you for your response. Yes, I have already download and add into Arduino's library. It still cannot function well.

Even I copy & paste my coding to Arduino Web Editor, it still have the same error.
Erna Erliyana
Posts: 2
Joined: Fri Feb 23, 2018 7:24 pm

Re: Arduino : lmic_SelectSubBand was not declared

Postby bengchet » Tue Feb 27, 2018 8:35 am


It is better to attach some hardware setup, photos, serial monitor log, arduino error log or any useful screenshots for better troubleshooting.

For library, please make sure you only have arduino lmic library downloaded from our github, no other duplicates from other website.

It still cannot function well.

Please make it more specific. It still cannot function well means you uploaded code succesfully but node is not functioning well? or still fail to upload code? or others?

I haven't tried on web editor, have you attempted to compile and upload program offline first?
Posts: 237
Joined: Tue Aug 25, 2015 8:29 am

Return to Getting Started - IoT

Who is online

Users browsing this forum: No registered users and 2 guests