program to test receiving packets from the gateway
Dependencies: libmDot mbed-rtos mbed-src
Diff: main.cpp
- Revision:
- 2:aadbdfb6d517
- Parent:
- 1:8295b8c0d802
--- 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());