Here it is ...
Dependencies: libxDot-mbed5 TSL2561
Fork of Dot-Examples by
Diff: examples/src/dot_util.cpp~
- Revision:
- 39:0d4362063352
- Parent:
- 37:4818522075f8
--- a/examples/src/dot_util.cpp~ Wed Jul 25 18:30:01 2018 +0000 +++ b/examples/src/dot_util.cpp~ Thu Jul 26 12:03:47 2018 -0400 @@ -1,6 +1,7 @@ #include "dot_util.h" #if defined(TARGET_XDOT_L151CC) #include "xdot_low_power.h" + #endif #if defined(TARGET_MTS_MDOT_F411RE) @@ -316,16 +317,17 @@ (*pc).printf("j_n(): network join SUCCESSFUL\r\n"); } -void sleep_wake_rtc_only(bool deepsleep) { +void sleep_wake_rtc_only(bool deepsleep, int delay, Serial *pc) { // in some frequency bands we need to wait until another channel is available before transmitting again // wait at least 10s between transmissions - uint32_t delay_s = dot->getNextTxMs() / 1000; - if (delay_s < 10) { + uint32_t delay_s;// = dot->getNextTxMs() / 1000; + /*if (delay_s < 10) { delay_s = 10; - } - - logInfo("%ssleeping %lus", deepsleep ? "deep" : "", delay_s); - logInfo("application will %s after waking up", deepsleep ? "execute from beginning" : "resume"); + }*/ + delay_s = delay; + + pc->printf("%ssleeping %lus ", deepsleep ? "deep " : " ", delay_s); + pc->printf("application will %s after waking up\r\n", deepsleep ? "execute from beginning" : "resume"); // lowest current consumption in sleep mode can only be achieved by configuring IOs as analog inputs with no pull resistors // the library handles all internal IOs automatically, but the external IOs are the application's responsibility @@ -729,8 +731,14 @@ } } -uint8_t get_light_data() { - return (uint8_t)(rand() % 100); +uint8_t get_light_data(TSL2561 *sensor, Serial *pc) { + + float raw_data = sensor->lux(); + pc->printf("raw data: %f\r\n", raw_data); + + return (uint8_t)raw_data; + + //return (uint8_t)(rand() % 100); } void ascii_converter(char *ret, uint8_t numData, std::vector<uint8_t> *tx_data, Serial *pc) {