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.
Revision 2:427bf460dd91, committed 2021-10-15
- Comitter:
- jmclaughlin
- Date:
- Fri Oct 15 01:50:47 2021 +0000
- Parent:
- 1:3cadb8807520
- Commit message:
- Code revised from Lichts to have multiple timers triggering LED2 and LED3 at 200ms and 400ms, respectively
Changed in this revision
A3_1_Single_Timer.lib | Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/A3_1_Single_Timer.lib Thu Oct 07 12:04:46 2021 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://os.mbed.com/users/slicht_instructor/code/A3_1_Single_Timer/#5597320f2dba
--- a/main.cpp Thu Oct 07 12:04:46 2021 +0000 +++ b/main.cpp Fri Oct 15 01:50:47 2021 +0000 @@ -1,24 +1,29 @@ -//Base code for modification for Assignment 2.2 -//Blinks LED2 every 200ms using a single Timer object. -//Created: S. Licht, 10/04/2020 +/* +Author: Jessica McLaughlin, revised from Stephen Licht +Last Modified: 10/14/2021 +Assignment: Multiple Timers, A2 Pt. 2 +*/ #include "mbed.h" -Timer timerLED2; //creat timer object +Timer timerLED2; //create timer object +Timer timerLED3; DigitalOut LEDOut2(LED2); +DigitalOut LEDOut3(LED3); int main() { timerLED2.start(); //start timer counting + timerLED3.start(); while(1) { if (timerLED2.read_ms()>=200) { //check to see if time has been exceeded LEDOut2 = !LEDOut2; timerLED2.reset(); //reset the timer back to zero - } //if timer - - //if you had other code that you wanted to execute faster, - //you could put it here! - + } + if (timerLED3.read_ms()>=400) { //if exceeds on for 400ms + LEDOut3 = !LEDOut3; + timerLED3.reset(); + } } //while -} +} \ No newline at end of file