Ive tried ssonzonoff’s code
(Rhf76-052am - getting it working with OTAA)
and I set it to my specifications with the US915 and changed the baud rate to 115200. I have also used the prepopulated arduino code from the LoRaWAN library for the OTAA setup and set the various keys in their respective spots, but that also didnt work. With the code from ssonzonoff I did see that the node was attempting to communicate to something, but when it toggled to try to connect, the connection timed out because the “lorawan modem is busy” and then it would prompt me to connect to a network.
//Prepopulated arduino code that came with the libraries i downloaded
#include <LoRaWan.h>
unsigned char data[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0xA,};
char buffer[256];
void setup(void)
{
SerialUSB.begin(115200);
while(!SerialUSB);
lora.init();
memset(buffer, 0, 256);
lora.getVersion(buffer, 256, 1);
SerialUSB.print(buffer);
memset(buffer, 0, 256);
lora.getId(buffer, 256, 1);
SerialUSB.print(buffer);
lora.setKey("2B7E151628AED2A6ABF7158809CF4F3C", "2B7E151628AED2A6ABF7158809CF4F3C", "2B7E151628AED2A6ABF7158809CF4F3C");
lora.setDeciveMode(LWOTAA);
lora.setDataRate(DR0, EU868);
lora.setChannel(0, 868.1);
lora.setChannel(1, 868.3);
lora.setChannel(2, 868.5);
lora.setReceiceWindowFirst(0);
lora.setReceiceWindowSecond(869.5, DR3);
lora.setPower(20);
while(!lora.setOTAAJoin(JOIN));
}
void loop(void)
{
bool result = false;
result = lora.transferPacket("Hello World!", 10);
//result = lora.transferPacket(data, 10, 10);
if(result)
{
short length;
short rssi;
memset(buffer, 0, 256);
length = lora.receivePacket(buffer, 256, &rssi);
if(length)
{
SerialUSB.print("Length is: ");
SerialUSB.println(length);
SerialUSB.print("RSSI is: ");
SerialUSB.println(rssi);
SerialUSB.print("Data is: ");
for(unsigned char i = 0; i < length; i ++)
{
SerialUSB.print("0x");
SerialUSB.print(buffer[i], HEX);
SerialUSB.print(" ");
}
SerialUSB.println();
}
}
}