Testing basic mdot with external Interrupt
Dependencies: libmDot mbed-rtos mbed-src
Fork of mDot_test_rx by
LoRaWAN Network Configuration
For DevEUI, AppEUI, AppKey configuration to specific network, please see lines 10 to 18.
If using with an 8 channel gateway define config_frequency_sub_band at line 16. Setting config_frequency_sub_band to '1' will limit the device to using just the first eight (8) channels starting at 902.3 MHz.
Free Running vs Interrupt
At line 117 you can change the program from waiting for external interrupts to free-running by changing msg_rdy to be equal to 'true'.
Diff: main.cpp
- Revision:
- 2:aadbdfb6d517
- Parent:
- 1:8295b8c0d802
- Child:
- 3:7cc5dfd22b54
--- a/main.cpp Fri Jun 26 19:40:51 2015 +0000 +++ b/main.cpp Fri Jul 10 18:44:02 2015 +0000 @@ -7,8 +7,8 @@ using namespace mts; -static std::string config_network_name = "<network name>"; -static std::string config_network_pass = "<network key>"; +static std::string config_network_name = ""; +static std::string config_network_pass = ""; static uint8_t config_frequency_sub_band = 1; int main() { @@ -17,6 +17,7 @@ int32_t ret; int32_t next_tx; + int32_t wait_time = 2; mDot* dot; std::vector<uint8_t> send_data; std::vector<uint8_t> recv_data; @@ -50,6 +51,9 @@ logError("failed to set network password: [%d][%s]", ret, mDot::getReturnCodeString(ret).c_str()); } + logInfo("enabling activity LED"); + dot->setActivityLedEnable(true); + logInfo("joining network"); while ((ret = dot->joinNetwork()) != mDot::MDOT_OK) { logError("failed to join network: [%d][%s]", ret, mDot::getReturnCodeString(ret).c_str()); @@ -80,6 +84,8 @@ next_tx = dot->getNextTxMs() + 1; logInfo("waiting %ld ms to transmit again", next_tx); wait_ms(next_tx); + logInfo("waiting another %d seconds", wait_time); + wait(wait_time); } logInfo("Version: %s", dot->getId().c_str());