-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from ElectronicCats/fix_actions
Fix Testing with Github Actions
- Loading branch information
Showing
5 changed files
with
92 additions
and
646 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/** | ||
* Example of ABP device | ||
* Authors: | ||
* Ivan Moreno | ||
* Eduardo Contreras | ||
* June 2019 | ||
* | ||
* This code is beerware; if you see me (or any other collaborator | ||
* member) at the local, and you've found our code helpful, | ||
* please buy us a round! | ||
* Distributed as-is; no warranty is given. | ||
*/ | ||
#include <lorawan.h> | ||
|
||
//ABP Credentials | ||
const char *devAddr = "00000000"; | ||
const char *nwkSKey = "00000000000000000000000000000000"; | ||
const char *appSKey = "00000000000000000000000000000000"; | ||
|
||
const unsigned long interval = 10000; // 10 s interval to send message | ||
unsigned long previousMillis = 0; // will store last time message sent | ||
unsigned int counter = 0; // message counter | ||
|
||
char myStr[50]; | ||
char outStr[255]; | ||
byte recvStatus = 0; | ||
|
||
const sRFM_pins RFM_pins = { | ||
.CS = 20, | ||
.RST = 9, | ||
.DIO0 = 0, | ||
.DIO1 = 1, | ||
.DIO2 = 2, | ||
.DIO5 = 15, | ||
}; | ||
|
||
void setup() { | ||
// Setup loraid access | ||
Serial.begin(115200); | ||
delay(2000); | ||
if(!lora.init()){ | ||
Serial.println("RFM95 not detected"); | ||
delay(5000); | ||
return; | ||
} | ||
|
||
// Set LoRaWAN Class change CLASS_A or CLASS_C | ||
lora.setDeviceClass(CLASS_A); | ||
|
||
// Set Data Rate | ||
lora.setDataRate(SF8BW125); | ||
|
||
// set channel to random | ||
lora.setChannel(MULTI); | ||
|
||
// Put ABP Key and DevAddress here | ||
lora.setNwkSKey(nwkSKey); | ||
lora.setAppSKey(appSKey); | ||
lora.setDevAddr(devAddr); | ||
} | ||
|
||
void loop() { | ||
// Check interval overflow | ||
if(millis() - previousMillis > interval) { | ||
previousMillis = millis(); | ||
|
||
sprintf(myStr, "Counter-%d", counter); | ||
|
||
Serial.print("Sending: "); | ||
Serial.println(myStr); | ||
|
||
lora.sendUplink(myStr, strlen(myStr), 0); | ||
counter++; | ||
} | ||
|
||
recvStatus = lora.readData(outStr); | ||
if(recvStatus) { | ||
Serial.println(outStr); | ||
} | ||
|
||
// Check Lora RX | ||
lora.update(); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.