Arduino Samples
Arduino samples can be found on the Arduino folder in the repository root. This code is built to be used for the Seeduino LoRaWan but can serve as reference for other platforms. We have region based examples for OTAA and ABP scenarios. Please follow the documentation to set up the device
Accessing the library files locally
There are multiple scenarios where we would want to have the libraries be modified (listed here below). To access the local installation, open your Arduino IDE, go to File -> Preferences and click on the line after "more preference can be edited directly in the file".
Go next to the path packages/Seeeduino/hardware/samd/1.8.2/libraries/LoRaWan
and open LoRaWan.cpp
and LoRaWan.h
in a text editor.
CN library changes
To run our China samples some changes to the library need to be done as described below.
paste the following in the LoRaWan.h file:
void setChannelON(unsigned char channel);
void setChannelOFF(unsigned char channel);
and respectively in the LoRaWan.cpp file:
void LoRaWanClass::setChannelON(unsigned char channel)
{
char cmd[32];
memset(cmd, 0, 32);
sprintf(cmd, "AT+CH=%d, ON\r\n", channel, (short)channel);
sendCommand(cmd);
#if _DEBUG_SERIAL_
loraDebugPrint(DEFAULT_DEBUGTIME);
#endif
delay(DEFAULT_TIMEWAIT);
}
void LoRaWanClass::setChannelOFF(unsigned char channel)
{
char cmd[32];
memset(cmd, 0, 32);
sprintf(cmd, "AT+CH=%d, OFF\r\n", channel, (short)channel);
sendCommand(cmd);
#if _DEBUG_SERIAL_
loraDebugPrint(DEFAULT_DEBUGTIME);
#endif
delay(DEFAULT_TIMEWAIT);
}
Activate Arduino debug mode
The following changes on the library can be done to enable debug mode on the seeduino device. This will get aditional details on the device transmission and operations.
paste the following in the LoRaWan.h file:
void setDebug();
and respectively in the LoRaWan.cpp file:
void LoRaWanClass::setDebug()
{
sendCommand("AT+LOG=DEBUG\r\n");
}
Created: 2022-01-10