megan gimple / Mbed 2 deprecated gimple_A2_Timers

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
mgimple
Date:
Thu Oct 14 23:46:44 2021 +0000
Parent:
2:f6ff7c4377b0
Commit message:
LED2 blinks every 200ms; LED3 blinks every 400ms

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 14 23:03:26 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 14 23:03:26 2021 +0000
+++ b/main.cpp	Thu Oct 14 23:46:44 2021 +0000
@@ -1,24 +1,28 @@
-//Base code for modification for Assignment 2.2
-//Blinks LED2 every 200ms using a single Timer object.
-//Created: S. Licht, 10/04/2020
+//OCE 360 Fall 2021
+//Assignment 2 Part 2
+//Megan Gimple
+//source code: s.licht
 
 #include "mbed.h"
 
-Timer timerLED2;  //creat timer object
+Timer timerLED2;  //Assigns the Timers
+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
+        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!
-        
-    } //while
+        }
+        if (timerLED3.read_ms()>400) {
+            LEDOut3 = !LEDOut3;
+            timerLED3.reset();
+        }
+    }
 }