Skip to content

Commit

Permalink
Change ttu to ttn
Browse files Browse the repository at this point in the history
  • Loading branch information
FokkeZB committed Aug 18, 2016
1 parent 516d715 commit 6e4b343
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 40 deletions.
6 changes: 3 additions & 3 deletions examples/DeviceInfo/DeviceInfo.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#define debugSerial Serial
#define loraSerial Serial1

TheThingsNetwork ttu;
TheThingsNetwork ttn;

void setup()
{
Expand All @@ -12,14 +12,14 @@ void setup()

delay(3000);

ttu.init(loraSerial, debugSerial);
ttn.init(loraSerial, debugSerial);
}

void loop()
{
debugSerial.println("Device Information");
debugSerial.println();
ttu.showStatus();
ttn.showStatus();
debugSerial.println();
debugSerial.println("Use the EUI to register the device for OTAA");
debugSerial.println("-------------------------------------------");
Expand Down
14 changes: 7 additions & 7 deletions examples/Downlink/downlink.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ const byte appKey[16] = { <insert AppKey> }; //for example: {0x73, 0x6D, 0x24, 0
#define debugPrintLn(...) { if (debugSerial) debugSerial.println(__VA_ARGS__); }
#define debugPrint(...) { if (debugSerial) debugSerial.print(__VA_ARGS__); }

TheThingsNetwork ttu;
TheThingsNetwork ttn;

void setup()
{
debugSerial.begin(115200);
loraSerial.begin(57600);

delay(1000);
ttu.init(loraSerial, debugSerial); //Initializing...
ttu.reset();
if (!ttu.join(appEui, appKey)) {
ttn.init(loraSerial, debugSerial); //Initializing...
ttn.reset();
if (!ttn.join(appEui, appKey)) {
delay(6000);
}

delay(6000);
ttu.showStatus();
ttn.showStatus();
debugPrintLn("Setup for The Things Network complete");

delay(1000);
Expand All @@ -35,13 +35,13 @@ void loop() {
// Send a byte
byte buf[1];
buf[0] = 20;
int downlinkBytes = ttu.sendBytes(buf, 1);
int downlinkBytes = ttn.sendBytes(buf, 1);

if (downlinkBytes > 0) {
debugPrintLn("Received " + String(downlinkBytes) + " bytes")
// Print the received bytes
for (int i = 0; i < downlinkBytes; i++) {
debugPrint(String(ttu.downlink[i]) + " ");
debugPrint(String(ttn.downlink[i]) + " ");
}
debugPrintLn();
}
Expand Down
12 changes: 6 additions & 6 deletions examples/SendABP/SendABP.ino
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,28 @@ String message = "Hello world"; //sending a string of chars "Hello world"
#define debugPrintLn(...) { if (debugSerial) debugSerial.println(__VA_ARGS__); }
#define debugPrint(...) { if (debugSerial) debugSerial.print(__VA_ARGS__); }

TheThingsNetwork ttu;
TheThingsNetwork ttn;

void setup() {
debugSerial.begin(115200);
loraSerial.begin(57600);

delay(1000);
ttu.init(loraSerial, debugSerial);
ttu.reset();
ttn.init(loraSerial, debugSerial);
ttn.reset();

//the device will configure the LoRa module
ttu.personalize(devAddr, nwkSKey, appSKey);
ttn.personalize(devAddr, nwkSKey, appSKey);

delay(6000);
ttu.showStatus();
ttn.showStatus();
debugPrintLn("Setup for The Things Network complete");

delay(1000);
}

void loop() {

ttu.sendString(message);
ttn.sendString(message);
delay(20000);
}
12 changes: 6 additions & 6 deletions examples/SendOTAA/SendOTAA.ino
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,31 @@ String message = "Hello world"; //sending a string of chars "Hello world"
#define debugPrintLn(...) { if (debugSerial) debugSerial.println(__VA_ARGS__); }
#define debugPrint(...) { if (debugSerial) debugSerial.print(__VA_ARGS__); }

TheThingsNetwork ttu;
TheThingsNetwork ttn;

void setup() {
debugSerial.begin(115200);
loraSerial.begin(57600);

delay(1000);
ttu.init(loraSerial, debugSerial);
ttu.reset();
ttn.init(loraSerial, debugSerial);
ttn.reset();

//the device will attempt a join every second till the join is successfull
while(!ttu.join(appEui, appKey)){
while(!ttn.join(appEui, appKey)){
delay(6000);
}

digitalWrite(13, HIGH); //turn on LED to confirm join

delay(6000);
ttu.showStatus();
ttn.showStatus();
debugPrintLn("Setup for The Things Network complete");

delay(1000);
}

void loop() {
ttu.sendString(message);
ttn.sendString(message);
delay(20000);
}
12 changes: 6 additions & 6 deletions examples/SensorExamples/DHTSensor/DHTSensor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ byte data[4];
#define debugPrintLn(...) { if (debugSerial) debugSerial.println(__VA_ARGS__); }
#define debugPrint(...) { if (debugSerial) debugSerial.print(__VA_ARGS__); }

TheThingsNetwork ttu;
TheThingsNetwork ttn;

void setup() {
debugSerial.begin(115200);
Expand All @@ -33,18 +33,18 @@ void setup() {
dht.begin();

delay(1000);
ttu.init(loraSerial, debugSerial);
ttu.reset();
ttn.init(loraSerial, debugSerial);
ttn.reset();

//the device will attempt a join every second till the join is successfull
while(!ttu.join(appEui, appKey)){
while(!ttn.join(appEui, appKey)){
delay(6000);
}

digitalWrite(13, HIGH); //turn on LED to confirm join

delay(6000);
ttu.showStatus();
ttn.showStatus();
debugPrintLn("Setup for The Things Network complete");

delay(1000);
Expand All @@ -65,7 +65,7 @@ void loop() {
debugPrint("Humidity: ");
debugPrintLn(humidity);
//send data
ttu.sendBytes(data, sizeof(data));
ttn.sendBytes(data, sizeof(data));

delay(20000);
}
12 changes: 6 additions & 6 deletions examples/SensorExamples/LightSensor/LightSensor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ byte data[2];
#define debugPrintLn(...) { if (debugSerial) debugSerial.println(__VA_ARGS__); }
#define debugPrint(...) { if (debugSerial) debugSerial.print(__VA_ARGS__); }

TheThingsNetwork ttu;
TheThingsNetwork ttn;

void setup() {
debugSerial.begin(115200);
Expand All @@ -25,18 +25,18 @@ void setup() {
pinMode(LightPin, INPUT);

delay(1000);
ttu.init(loraSerial, debugSerial);
ttu.reset();
ttn.init(loraSerial, debugSerial);
ttn.reset();

//the device will attempt a join every second till the join is successfull
while(!ttu.join(appEui, appKey)){
while(!ttn.join(appEui, appKey)){
delay(6000);
}

digitalWrite(13, HIGH); //turn on LED to confirm join

delay(6000);
ttu.showStatus();
ttn.showStatus();
debugPrintLn("Setup for The Things Network complete");

delay(1000);
Expand All @@ -52,7 +52,7 @@ void loop() {
debugPrint("Transmitting Light level: ");
debugPrintLn(light);
//send data
ttu.sendBytes(data, sizeof(data));
ttn.sendBytes(data, sizeof(data));

delay(20000);
}
12 changes: 6 additions & 6 deletions examples/Workshop/Workshop.ino
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const byte appSKey[16] = { ... };
#define debugPrintLn(...) { if (debugSerial) debugSerial.println(__VA_ARGS__); }
#define debugPrint(...) { if (debugSerial) debugSerial.print(__VA_ARGS__); }

TheThingsNetwork ttu;
TheThingsNetwork ttn;

void setup() {
// Set up the serial interfaces for the debugging serial monitor and LoRa module
Expand All @@ -32,14 +32,14 @@ void setup() {
delay(1000);

// Initialize and reset The Things Uno
ttu.init(loraSerial, debugSerial);
ttu.reset();
ttn.init(loraSerial, debugSerial);
ttn.reset();

// Here we activate the device with your address and keys
ttu.personalize(devAddr, nwkSKey, appSKey);
ttn.personalize(devAddr, nwkSKey, appSKey);

// Show the status on the debugging serial monitor
ttu.showStatus();
ttn.showStatus();
debugPrintLn("Setup for The Things Network complete");
}

Expand All @@ -48,7 +48,7 @@ void loop() {
byte data[3] = { 0x01, 0x02, 0x03 };

// Send it to the network
ttu.sendBytes(data, sizeof(data));
ttn.sendBytes(data, sizeof(data));

// Wait 10 seconds
delay(10000);
Expand Down

0 comments on commit 6e4b343

Please sign in to comment.