![]() |
RUI3 (RAK Unified Interface 3) - RAK4631
|
Public Member Functions | |
bool | get (uint8_t *buf, uint32_t len) |
bool | set (uint8_t *buf, uint32_t len) |
bool get | ( | uint8_t * | buf, |
uint32_t | len | ||
) |
buf | the buffer to get device address |
len | the length of device address(must be 4 bytes) |
TRUE | for getting device address successfully |
FALSE | for getting device address failure |
// ABP Device Address uint8_t node_dev_addr[4] = {0x05, 0x05, 0x06, 0x06}; void setup() { Serial.begin(115200); api.lorawan.njm.set(RAK_LORA_ABP); // Set LoRaWan join mode to ABP if(api.lorawan.daddr.set(node_dev_addr, 4) == true) Serial.println("LoRaWan device address set success"); else Serial.println("LoRaWan device address set fail"); } void loop() { uint8_t buff[4]; if(api.lorawan.daddr.get(buff, 4) == true) { Serial.print("LoRaWan device address = 0x"); for(int i = 0; i < 4; i++) { Serial.printf("%02X", buff[i]); } Serial.println(""); } else { Serial.println("LoRaWan device address get fail"); } delay(1000); }
bool set | ( | uint8_t * | buf, |
uint32_t | len | ||
) |
buf | the buffer to set device address |
len | the length of device address(must be 4 bytes) |
TRUE | for setting device address successfully |
FALSE | for setting device address failure |
// ABP Device Address uint8_t node_dev_addr[4] = {0x05, 0x05, 0x06, 0x06}; void setup() { Serial.begin(115200); api.lorawan.njm.set(RAK_LORA_ABP); // Set LoRaWan join mode to ABP if(api.lorawan.daddr.set(node_dev_addr, 4) == true) Serial.println("LoRaWan device address set success"); else Serial.println("LoRaWan device address set fail"); } void loop() { uint8_t buff[4]; if(api.lorawan.daddr.get(buff, 4) == true) { Serial.print("LoRaWan device address = 0x"); for(int i = 0; i < 4; i++) { Serial.printf("%02X", buff[i]); } Serial.println(""); } else { Serial.println("LoRaWan device address get fail"); } delay(1000); }