Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: libmDot-Custom
Fork of mDot_LoRa_Connect_Example by
The project is a starting point for the AS923 channel plan.
Default frequencies are 923.2 and 923.4 Join Datarate is set to DR2:SF10BW125 Additional channels can be added in JoinAccept message or through new channel mac commands
New MAC commands in LoRaWAN 1.02 have NOT been included to set the DwellTime and MaxEIRP Overriding this function is available to someone who would like to do this. virtual uint8_t HandleMacCommands(uint8_t* payload, uint8_t index, uint8_t end_index);
Diff: main.cpp
- Revision:
- 7:6aac90ea2240
- Parent:
- 6:f0b6fea36e28
- Child:
- 8:945bf15931ee
--- a/main.cpp Tue Apr 12 23:44:25 2016 +0000
+++ b/main.cpp Mon Sep 19 15:16:00 2016 +0000
@@ -4,22 +4,37 @@
#include <string>
#include <vector>
#include <algorithm>
+#include "CustomChannelPlan_AS923.h"
// these options must match the settings on your Conduit
// uncomment the following lines and edit their values to match your configuration
-static std::string config_network_name = "<lora network id>";
-static std::string config_network_pass = "<lora network key>";
+static std::string config_network_name = "sad face";
+static std::string config_network_pass = "happy face";
static uint8_t config_frequency_sub_band = 1;
+Serial debug(USBTX, USBRX);
+
int main() {
+ debug.baud(115200);
+ debug.printf("hello");
+
int32_t ret;
mDot* dot;
std::vector<uint8_t> data;
std::string data_str = "hello!";
+ debug.printf("get mdot");
+
// get a mDot handle
dot = mDot::getInstance();
+ debug.printf("set channel plan");
+
+ lora::CustomChannelPlan_AS923* plan = new lora::CustomChannelPlan_AS923(*dot->getRadio(), *dot->getSettings());
+ dot->setChannelPlan(plan);
+
+ debug.printf("done");
+
// print library version information
logInfo("version: %s", dot->getId().c_str());
@@ -29,7 +44,7 @@
// reset to default config so we know what state we're in
dot->resetConfig();
- dot->setLogLevel(mts::MTSLog::INFO_LEVEL);
+ dot->setLogLevel(mts::MTSLog::TRACE_LEVEL);
// set up the mDot with our network information: frequency sub band, network name, and network password
// these can all be saved in NVM so they don't need to be set every time - see mDot::saveConfig()
@@ -38,10 +53,10 @@
// if using a MultiTech Conduit gateway, use the same sub band as your Conduit (1-8) - the mDot will use the 8 channels in that sub band
// if using a gateway that supports all 64 channels, use sub band 0 - the mDot will use all 64 channels
-// logInfo("setting to public network");
-// if ((ret = dot->setPublicNetwork(true)) != mDot::MDOT_OK) {
-// logError("failed to set public network %d:%s", ret, mDot::getReturnCodeString(ret).c_str());
-// }
+ logInfo("setting to public network");
+ if ((ret = dot->setPublicNetwork(true)) != mDot::MDOT_OK) {
+ logError("failed to set public network %d:%s", ret, mDot::getReturnCodeString(ret).c_str());
+ }
logInfo("setting frequency sub band");
if ((ret = dot->setFrequencySubBand(config_frequency_sub_band)) != mDot::MDOT_OK) {
