kopia lustrzana https://github.com/helium/longfi-arduino
commit
3c9dbe770c
|
@ -1,9 +1,21 @@
|
|||
|
||||
# Helium Basic Example
|
||||
|
||||
Here you will find a very basic example of a WisBlock/Helium embedded project that uses the Arduino IDE.
|
||||
This version will join the Helium network and periodically send a "Hello" to the Helium network.
|
||||
|
||||
## Support Library Version Incompatibility
|
||||
Recent API changes to the runtime support library, SX126x-Arduino, have resulted in library version incompatibility between version 1.3x and version 2.x.
|
||||
|
||||
| :warning: WARNING: This will require changes to the Arduino IDE installation, in particular the installed board support package files. The complete details of the changes required can be found [here](https://github.com/beegee-tokyo/SX126x-Arduino/blob/master/README_V2.md).|
|
||||
|:---------------------------|
|
||||
|
||||
In addition to the IDE support file changes there are two major changes at the device application level if you are moving from version 1 to version 2 of the support library:
|
||||
* The lmh_init() API requires 2 more parameters
|
||||
* the device application is no longer required to call Radio.IrqProcess() within it's main processing loop. The processing will now be handled by the runtime layer.
|
||||
|
||||
The sample .ino file has been updated to be compatible with version 2 of the support library.
|
||||
|
||||
|
||||
### Hardware
|
||||
The only hardware required is:
|
||||
* the [WisBlock Starter Kit](https://store.rakwireless.com/products/wisblock-starter-kit) containing the base board with the core module installed.
|
||||
|
@ -11,7 +23,7 @@ The only hardware required is:
|
|||
|
||||
#### Antenna Type/location
|
||||
The WisBlock starter kit comes with two antenna types,
|
||||
* the one that resembles an "I" is the LoRa antenna, this one connects to the connector on the core moduke marked LoRa, which is below the large K in the RAK logo.
|
||||
* the one that resembles an "I" is the LoRa antenna, this one connects to the connector on the core module marked LoRa, which is below the large K in the RAK logo.
|
||||
* the one that resembles a "T" is the BLE antenna, this one connects to the connector on the core module marked BLE
|
||||
|
||||
### Sample Decoder
|
||||
|
|
|
@ -68,7 +68,10 @@ uint8_t nodeDeviceEUI[8] = {0x00, 0x00, 0xDA, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|||
uint8_t nodeAppEUI[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
uint8_t nodeAppKey[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
|
||||
// Define the LoRaWan Region of choice
|
||||
// refer to the runtime support library file LoRaMac.h, region enumeration "eLoRaMacRegion_t"
|
||||
// for a list of supported regions
|
||||
#define LORA_REGION LORAMAC_REGION_US915
|
||||
|
||||
// Private defination
|
||||
#define LORAWAN_APP_DATA_BUFF_SIZE 64 /**< buffer size of the data to be transmitted. */
|
||||
|
@ -98,30 +101,9 @@ void setup()
|
|||
Serial.println("=====================================");
|
||||
Serial.println("Welcome to RAK4630 LoRaWan!!!");
|
||||
Serial.println("Type: OTAA");
|
||||
|
||||
#if defined(REGION_AS923)
|
||||
Serial.println("Region: AS923");
|
||||
#elif defined(REGION_AU915)
|
||||
Serial.println("Region: AU915");
|
||||
#elif defined(REGION_CN470)
|
||||
Serial.println("Region: CN470");
|
||||
#elif defined(REGION_CN779)
|
||||
Serial.println("Region: CN779");
|
||||
#elif defined(REGION_EU433)
|
||||
Serial.println("Region: EU433");
|
||||
#elif defined(REGION_IN865)
|
||||
Serial.println("Region: IN865");
|
||||
#elif defined(REGION_EU868)
|
||||
Serial.println("Region: EU868");
|
||||
#elif defined(REGION_KR920)
|
||||
Serial.println("Region: KR920");
|
||||
#elif defined(REGION_US915)
|
||||
// NOTE: Update per your region setting
|
||||
Serial.println("Region: US915");
|
||||
#elif defined(REGION_US915_HYBRID)
|
||||
Serial.println("Region: US915_HYBRID");
|
||||
#else
|
||||
Serial.println("Please define a region in the compiler options.");
|
||||
#endif
|
||||
|
||||
Serial.println("=====================================");
|
||||
|
||||
//creat a user timer to send data to server period
|
||||
|
@ -137,8 +119,9 @@ void setup()
|
|||
lmh_setAppEui(nodeAppEUI);
|
||||
lmh_setAppKey(nodeAppKey);
|
||||
|
||||
|
||||
// Initialize LoRaWan
|
||||
err_code = lmh_init(&lora_callbacks, lora_param_init, doOTAA);
|
||||
err_code = lmh_init(&lora_callbacks, lora_param_init, doOTAA, CLASS_A, LORA_REGION);
|
||||
if (err_code != 0)
|
||||
{
|
||||
Serial.printf("lmh_init failed - %d\n", err_code);
|
||||
|
@ -152,8 +135,7 @@ void setup()
|
|||
|
||||
void loop()
|
||||
{
|
||||
// Handle Radio events
|
||||
Radio.IrqProcess();
|
||||
// user code
|
||||
}
|
||||
|
||||
/**@brief LoRa function for handling HasJoined event.
|
||||
|
|
Ładowanie…
Reference in New Issue