SOC-1
Dependencies: libmDot mbed-rtos mbed
Fork of mDot_LoRa_Sleep_Example by
Revision 5:2099d1d64f85, committed 2015-10-24
- Comitter:
- socie123
- Date:
- Sat Oct 24 04:10:59 2015 +0000
- Parent:
- 4:ac599fe6bc41
- Commit message:
- SOC1
Changed in this revision
--- a/main.cpp Wed Sep 30 20:06:52 2015 +0000
+++ b/main.cpp Sat Oct 24 04:10:59 2015 +0000
@@ -7,15 +7,19 @@
// 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 uint8_t config_frequency_sub_band = 1;
+static std::string config_network_name = "watchlink";
+static std::string config_network_pass = "watchlink";
+static uint8_t config_frequency_sub_band = 1;
int main() {
int32_t ret;
mDot* dot;
std::vector<uint8_t> data;
- std::string data_str = "hello!";
+ //bool send(const std::string text);
+ //std::char<uint8_t> latestdata;
+
+
+ AnalogIn temperatureSensor(PC_1); //A2 on Arduino base shield
// get a mDot handle
dot = mDot::getInstance();
@@ -80,10 +84,22 @@
//*******************************************
// end of configuration
//*******************************************
+
+
+ uint16_t analogReading;
+ analogReading = temperatureSensor.read_u16();
+
+ char latestdata[100];
+ //std::vector<uint8_t> data;
+
+ //data = latestdata ;
+ sprintf(latestdata, "temp: %d", analogReading);
+ printf("%s\r\n", latestdata);
+
// format data for sending to the gateway
- for (std::string::iterator it = data_str.begin(); it != data_str.end(); it++)
- data.push_back((uint8_t) *it);
+ //for (std::string::iterator it = data.begin(); it != data.end(); it++)
+ //data.push_back((uint8_t) *it);
// join the network if not joined
if (!dot->getNetworkJoinStatus()) {
@@ -95,7 +111,8 @@
if (dot->getNetworkJoinStatus()) {
// send the data
// ACKs are enabled by default, so we're expecting to get one back
- if ((ret = dot->send(data)) != mDot::MDOT_OK) {
+ std::vector<uint8_t> latestdata;//(text.begin(), text.end());
+ if ((ret = dot->send(latestdata)) != mDot::MDOT_OK) {
logError("failed to send %d:%s", ret, mDot::getReturnCodeString(ret).c_str());
} else {
logInfo("successfully sent data to gateway");
--- a/mbed-rtos.lib Wed Sep 30 20:06:52 2015 +0000 +++ b/mbed-rtos.lib Sat Oct 24 04:10:59 2015 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/users/mbed_official/code/mbed-rtos/#d7bd06319118 +https://developer.mbed.org/users/mbed_official/code/mbed-rtos/#12552ef4e980
--- a/mbed.bld Wed Sep 30 20:06:52 2015 +0000 +++ b/mbed.bld Sat Oct 24 04:10:59 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/4f6c30876dfa \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/34e6b704fe68 \ No newline at end of file
