Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. #include "TheThingsUno.h"
  2.  
  3. // Set your DevAddr
  4. const byte devAddr[4] = { 0x1C, 0xA2, 0x0A, 0xB3 }; //for example: {0x02, 0xDE, 0xAE, 0x00};
  5. // checked 290816 DevAddres ={ 0x1C, 0xA2, 0x0A, 0xB3 } MSBF so correct
  6.  
  7. // Set your NwkSKey and AppSKey
  8. 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};
  9. 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};
  10. ]// check 280816: msbf AppSKey={ 0x22, (some more) 0x55 } so correct
  11. // check 280816: msbf NwkSKey={ 0x93, (some more) 0x3A } so correct
  12.  
  13. // Set your message to send
  14. String message = "H"; //sending a string of chars "Hello world"
  15.  
  16. #define debugSerial Serial
  17. #define loraSerial Serial1
  18.  
  19. #define debugPrintLn(...) { if (debugSerial) debugSerial.println(__VA_ARGS__); }
  20. #define debugPrint(...) { if (debugSerial) debugSerial.print(__VA_ARGS__); }
  21.  
  22. TheThingsUno ttu;
  23.  
  24. void setup() {
  25. debugSerial.begin(115200);
  26. loraSerial.begin(57600);
  27.  
  28. delay(1000);
  29. ttu.init(loraSerial, debugSerial);
  30. ttu.reset();
  31.  
  32. //the device will configure the LoRa module
  33. ttu.personalize(devAddr, nwkSKey, appSKey);
  34.  
  35. delay(6000);
  36. ttu.showStatus();
  37. debugPrintLn("Setup for The Things Network complete");
  38.  
  39. delay(1000);
  40. }
  41.  
  42. void loop() {
  43.  
  44. ttu.sendString(message);
  45. delay(20000);
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement