Note! This project has moved to github.com/armmbed/mbed-events
You are viewing an older revision! See the latest version
Homepage
#include "Event.h" DigitalOut r(LED_RED); DigitalOut g(LED_GREEN); DigitalOut b(LED_BLUE); void blink(DigitalOut *led) { *led = !*led; } Binder<void(DigitalOut *), DigitalOut *> blinkr(blink, &r); Binder<void(DigitalOut *), DigitalOut *> blinkg(blink, &g); Binder<void(DigitalOut *), DigitalOut *> blinkb(blink, &b); int main() { EventQueue queue; Event<void()> eventr(&queue, &blinkr); eventr.period(90); eventr(); Ticker ticker; Event<void()> eventg(&queue, &blinkg); ticker.attach(&eventg, 0.11f); while (true) { queue.dispatch(100); blinkb(); } }