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.
Dependencies: mbed
Fork of TIMER by
Main.cpp
00001 /* https://os.mbed.com/docs/v5.7/reference/timer.html 00002 00003 Use the Timer interface to create, start, stop and read a timer for measuring small times (between microseconds and seconds). 00004 You can independently create, start and stop any number of Timer objects. 00005 */ 00006 00007 // Count the time to toggle a LED 00008 00009 #include "mbed.h" 00010 00011 Timer timer; 00012 DigitalOut led(LED1); 00013 int begin, end; 00014 00015 int main() { 00016 00017 while(1) { 00018 timer.start(); 00019 begin = timer.read_us(); 00020 led = !led; 00021 end = timer.read_us(); 00022 printf("Toggle the led takes %d us \n", end - begin); 00023 wait(1); 00024 } 00025 }
Generated on Thu Oct 13 2022 09:29:20 by
1.7.2
