Yaakov Husarsky / Mbed OS Nucleo_gyro

Dependencies:   Nucleo_ticker

Committer:
tulanthoar
Date:
Fri Apr 21 19:36:21 2017 +0000
Revision:
0:573c02b712fe
Child:
2:ba7945a8d1c6
nucleo ticker example

Who changed what in which revision?

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