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: BME280 SerialGPS libmDot mbed-rtos mbed
Revision 7:9e2454b0318a, committed 2016-07-08
- Comitter:
- AshuJoshi
- Date:
- Fri Jul 08 03:09:14 2016 +0000
- Parent:
- 6:35f934e83c74
- Child:
- 8:c17b68b03791
- Commit message:
- Now stable - can join the LoRa network in OTAA mode.
Changed in this revision
| libmDot.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/libmDot.lib Fri Jul 08 03:00:43 2016 +0000 +++ b/libmDot.lib Fri Jul 08 03:09:14 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/teams/MultiTech/code/libmDot/#121e4c454964 +http://mbed.org/teams/MultiTech/code/libmDot/#50142f513ba8
--- a/main.cpp Fri Jul 08 03:00:43 2016 +0000
+++ b/main.cpp Fri Jul 08 03:09:14 2016 +0000
@@ -11,7 +11,7 @@
#include "MTSText.h"
#include <string>
- //#include "BME280.h"
+ #include "BME280.h"
//#include "SerialGPS.h"
using namespace mts;
@@ -62,7 +62,7 @@
//SerialGPS gps(PA_2, PA_3);
//BME280 sensor(I2C_SDA, I2C_SCL)
// MDot UDK - I2C_SDA and I2C_SCL connected to PC_9/PA_*
-//BME280 b280(PC_9, PA_8);
+BME280 b280(PC_9, PA_8);
// Serial via USB for debugging only
//Serial pc(USBTX,USBRX);
@@ -71,7 +71,7 @@
void endLessTestLoop();
void setUpLEDBlink();
void blink();
-//void readandprintBME280();
+void readandprintBME280();
void mDotConfig();
void mDotGotoDeepSleep(int seconds);
void mDotConfigPrint();
@@ -90,11 +90,10 @@
// Simple Test Functions, "Hello World on UDK
setUpLEDBlink();
- //mDotConfig();
+ mDotConfig();
setupNetwork();
- //mDotConfigPrint();
//wait(15);
- // joinNetwork();
+ joinNetwork();
endLessTestLoop();
return 0;
@@ -136,15 +135,15 @@
std::vector<uint8_t> appKey;
// get a mDot handle
- dot = mDot::getInstance();
+ // dot = mDot::getInstance();
//*******************************************
// configuration
//*******************************************
//dot->setLogLevel(mts::MTSLog::INFO_LEVEL);
- dot->setLogLevel(mts::MTSLog::TRACE_LEVEL);
- logInfo("Checking Config");
+ //dot->setLogLevel(mts::MTSLog::TRACE_LEVEL);
+ //logInfo("Checking Config");
// Test if we've already saved the config
std::string configNetworkName = dot->getNetworkName();
@@ -253,7 +252,13 @@
//char dataBuf[50];
- //int32_t ret;
+
+
+
+}
+
+void joinNetwork() {
+ int32_t ret;
logInfo("Joining Network");
while ((ret = dot->joinNetwork()) != mDot::MDOT_OK) {
@@ -264,7 +269,6 @@
logInfo("Joined Network");
wait(10);
-
}
@@ -333,7 +337,7 @@
* Sensor Functions
****************************************************/
-/*
+
void readandprintBME280() {
float temperature;
float pressure;
@@ -360,7 +364,7 @@
//printf("%2.2f degC, %04.2f hPa, %2.2f %%\n", temperature, pressure, humidity);
}
-*/
+
/*****************************************************
@@ -375,8 +379,8 @@
void endLessTestLoop() {
while(true) {
// printf("Hello world!\r\n");
- printf("BME280 Sensor: \n");
- //readandprintBME280();
+ //printf("BME280 Sensor: \n");
+ readandprintBME280();
wait(5);
//mDotGotoDeepSleep(60);