NHẤP NHÁY LED DÙNG TIMER STM32 - MBED
#include "mbed.h" Timer timer01; // define timer object DigitalOut LED_0(PC_13); // digital output LED PC13 void TIMER_PROGRAM(void); // task function prototype int main() { timer01.start(); // start timer counting while(1) { if (timer01.read_ms()>=500) { // read time in ms TIMER_PROGRAM(); // call task function
timer01.reset(); // reset timer } } } void TIMER_PROGRAM(void) // task function
{ LED_0=!LED_0; // toggle output }