Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 00003 Ticker toggle_led_ticker; 00004 00005 DigitalOut led1(LED1); 00006 DigitalOut led2(LED2); 00007 DigitalOut led3(LED3); 00008 00009 volatile uint8_t counter = 0; 00010 00011 void toggle_led() { 00012 led1 = counter & 1; 00013 led2 = counter & 2; 00014 led3 = counter & 4; 00015 } 00016 00017 int main() { 00018 // Init the ticker with the address of the function (toggle_led) to be attached and the interval (100 ms) 00019 toggle_led_ticker.attach(&toggle_led, 0.1); 00020 while (true) { 00021 counter += 1; 00022 wait(1); 00023 // Do other things... 00024 } 00025 }
Generated on Wed Jul 20 2022 21:05:25 by
1.7.2