NUCLEO-F042K6 Simple demo blinking LED using ticker

Dependencies:   mbed

Committer:
vodsejak
Date:
Sat Feb 10 15:05:51 2018 +0000
Revision:
1:6428af2e51f5
Parent:
0:8eb6644d6308
v1.1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vodsejak 0:8eb6644d6308 1 #include "mbed.h"
vodsejak 0:8eb6644d6308 2
vodsejak 0:8eb6644d6308 3 /*******************************************************************************
vodsejak 0:8eb6644d6308 4
vodsejak 0:8eb6644d6308 5 EXAMPLE DESCRIPTION
vodsejak 0:8eb6644d6308 6
vodsejak 0:8eb6644d6308 7 Initialize ticker that periodically (100 ms) calls function that toggles
vodsejak 0:8eb6644d6308 8 onboard LED.
vodsejak 0:8eb6644d6308 9
vodsejak 0:8eb6644d6308 10 *******************************************************************************/
vodsejak 0:8eb6644d6308 11
vodsejak 0:8eb6644d6308 12 Ticker tick; // Ticker definition
vodsejak 0:8eb6644d6308 13
vodsejak 0:8eb6644d6308 14 DigitalOut LED(LED1); // definition of digital out pin
vodsejak 0:8eb6644d6308 15
vodsejak 0:8eb6644d6308 16 // Toggles LED
vodsejak 1:6428af2e51f5 17 void toggleLED() {
vodsejak 0:8eb6644d6308 18 LED = !LED;
vodsejak 0:8eb6644d6308 19 }
vodsejak 0:8eb6644d6308 20
vodsejak 0:8eb6644d6308 21 int main() {
vodsejak 1:6428af2e51f5 22 tick.attach(&toggleLED, 0.1); // Init the ticker with the address of the
vodsejak 0:8eb6644d6308 23 // function (toggle_led) to be attached and
vodsejak 0:8eb6644d6308 24 // the interval (100 ms)
vodsejak 0:8eb6644d6308 25 while (true) {
vodsejak 0:8eb6644d6308 26 // main programm loop - can do other things
vodsejak 0:8eb6644d6308 27 }
vodsejak 0:8eb6644d6308 28 }