condens project

Dependencies:   mbed MbedJSONValue

main.cpp

Committer:
duchonic
Date:
2019-08-22
Revision:
0:8dd13dfd2e4e
Child:
1:5abef2328a97

File content as of revision 0:8dd13dfd2e4e:

#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);
    }
}