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 00002 /* RTOS timer example 00003 * This program was borrowed from the book 00004 * 'ARM-Based microcontroller projects using MBED' 00005 * written by Dogan Ibrahim 00006 * Newsnes (an imprint of Elsevier) 2019. ISBN: 978-0-08-102969-5 00007 * 00008 * https://www.sciencedirect.com/book/9780081029695/arm-based-microcontroller-projects-using-mbed 00009 */ 00010 00011 #include "mbed.h" 00012 #include "rtos.h" 00013 DigitalOut led(LED1); 00014 00015 void Flash() { 00016 led = !led; // Flash the LED 00017 } 00018 00019 int main() { 00020 led = 1; 00021 RtosTimer timer(Flash); // Create a timer 00022 timer.start(500); // Start the timer 00023 Thread::wait(5000); // Wait 5 seconds 00024 timer.stop(); // Stop the timer 00025 00026 Thread::wait(osWaitForever); // Wait forever 00027 } 00028
Generated on Tue Sep 20 2022 06:23:41 by
1.7.2