dis ma publish

Dependencies:   mbed

Committer:
bogthe
Date:
Tue Dec 18 14:33:55 2018 +0000
Revision:
0:d2d668a6af00
muh

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogthe 0:d2d668a6af00 1 #include "mbed.h"
bogthe 0:d2d668a6af00 2
bogthe 0:d2d668a6af00 3 Ticker toggle_led_ticker;
bogthe 0:d2d668a6af00 4
bogthe 0:d2d668a6af00 5 DigitalOut led1(LED1);
bogthe 0:d2d668a6af00 6
bogthe 0:d2d668a6af00 7 void toggle_led() {
bogthe 0:d2d668a6af00 8 led1 = !led1;
bogthe 0:d2d668a6af00 9 }
bogthe 0:d2d668a6af00 10
bogthe 0:d2d668a6af00 11 int main() {
bogthe 0:d2d668a6af00 12 // Init the ticker with the address of the function (toggle_led) to be attached and the interval (100 ms)
bogthe 0:d2d668a6af00 13 toggle_led_ticker.attach(&toggle_led, 0.1);
bogthe 0:d2d668a6af00 14 while (true) {
bogthe 0:d2d668a6af00 15 // Do other things...
bogthe 0:d2d668a6af00 16 }
bogthe 0:d2d668a6af00 17 }