![](/media/cache/profiles/622e24f22a5ad66b6cdfe63c256ff01b.jpg.50x50_q85.jpg)
Example of using Ticker or Timeout with libmDot Ticker did not work with the mDot instantiated
Fork of Ticker_HelloWorld by
Diff: main.cpp
- Revision:
- 5:36b17c45c560
- Parent:
- 2:87f26931d8d1
- Child:
- 6:f9d35ed0d0d8
--- a/main.cpp Tue Jun 27 11:37:57 2017 -0500 +++ b/main.cpp Wed Feb 28 13:44:33 2018 +0000 @@ -14,18 +14,46 @@ * limitations under the License. */ #include "mbed.h" +#include "rtos.h" +#include "mDot.h" +#include "ChannelPlans.h" -Ticker flipper; -DigitalOut led1(LED1); -DigitalOut led2(LED2); +DigitalOut led1(LED2); +DigitalOut led2(XBEE_RSSI); +void flip(); + + +//RtosTimer flipper(&flip); +// +//void flip() { +// led2 = !led2; +// flipper.start(2000); +//} +// + + +Timeout flipper; void flip() { - led2 = !led2; + led2 = !led2; } + int main() { - led2 = 1; - flipper.attach(&flip, 2.0); // the address of the function to be attached (flip) and the interval (2 seconds) + + mDot* dot; + + lora::ChannelPlan* plan = new lora::ChannelPlan_US915(); + + // get a mDot handle + dot = mDot::getInstance(plan); + + dot->setJoinMode(mDot::MANUAL); + + led2 = 1; +// flipper.start(2000); + + flipper.attach(&flip, 2.0); // setup flipper to call flip after 2 seconds // spin in a main loop. flipper will interrupt it to call flip while(1) {