Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "TheThingsUno.h"
- // Set your DevAddr
- const byte devAddr[4] = { 0x1C, 0xA2, 0x0A, 0xB3 }; //for example: {0x02, 0xDE, 0xAE, 0x00};
- // checked 290816 DevAddres ={ 0x1C, 0xA2, 0x0A, 0xB3 } MSBF so correct
- // Set your NwkSKey and AppSKey
- const byte nwkSKey[16] = { 0x93, (some more) 0x3A }; //for example: {0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C};
- const byte appSKey[16] = { 0x22, (some more), 0x55 }; //for example: {0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C};
- ]// check 280816: msbf AppSKey={ 0x22, (some more) 0x55 } so correct
- // check 280816: msbf NwkSKey={ 0x93, (some more) 0x3A } so correct
- // Set your message to send
- String message = "H"; //sending a string of chars "Hello world"
- #define debugSerial Serial
- #define loraSerial Serial1
- #define debugPrintLn(...) { if (debugSerial) debugSerial.println(__VA_ARGS__); }
- #define debugPrint(...) { if (debugSerial) debugSerial.print(__VA_ARGS__); }
- TheThingsUno ttu;
- void setup() {
- debugSerial.begin(115200);
- loraSerial.begin(57600);
- delay(1000);
- ttu.init(loraSerial, debugSerial);
- ttu.reset();
- //the device will configure the LoRa module
- ttu.personalize(devAddr, nwkSKey, appSKey);
- delay(6000);
- ttu.showStatus();
- debugPrintLn("Setup for The Things Network complete");
- delay(1000);
- }
- void loop() {
- ttu.sendString(message);
- delay(20000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement