condens
Dependencies: mbed MbedJSONValue
Diff: main.cpp
- Revision:
- 0:8dd13dfd2e4e
- Child:
- 1:5abef2328a97
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Aug 22 10:51:23 2019 +0000 @@ -0,0 +1,33 @@ +#include "mbed.h" + +Ticker toggle_led_ticker; +Ticker sendStuffTicker; + +DigitalOut led1(LED1); +DigitalOut led2(LED2); +Serial pc(SERIAL_TX, SERIAL_RX); + +void toggle_led() { + led1 = !led1; +} + +void sendStuff() { + static int counter=0; + pc.printf("some stuff %u\n", counter++); +} + + +int main() { + pc.baud(115200); + pc.printf("start main()\n\r"); + + // Init the ticker with the address of the function (toggle_led) to be attached and the interval (100 ms) + toggle_led_ticker.attach(&toggle_led, 0.1); + sendStuffTicker.attach(&sendStuff, 1); + + while (true) { + // Do other things... + led2 = !led2; + wait(1); + } +} \ No newline at end of file