ECE 4180 Lab 3 Part 2

Dependencies:   mbed

Fork of Ticker_HelloWorld by mbed official

Files at this revision

API Documentation at this revision

Comitter:
abraha2d
Date:
Tue Oct 16 00:23:53 2018 +0000
Parent:
0:5014bf742e9b
Commit message:
Save point

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 5014bf742e9b -r adae4a00fbfe main.cpp
--- a/main.cpp	Thu Feb 14 14:30:22 2013 +0000
+++ b/main.cpp	Tue Oct 16 00:23:53 2018 +0000
@@ -1,20 +1,39 @@
 #include "mbed.h"
  
-Ticker flipper;
+Ticker flipper1;
+Ticker flipper2;
+Ticker flipper3;
+Ticker flipper4;
+
 DigitalOut led1(LED1);
 DigitalOut led2(LED2);
+DigitalOut led3(LED3);
+DigitalOut led4(LED4);
  
-void flip() {
+void flip1() {
+    led1 = !led1;
+}
+ 
+void flip2() {
     led2 = !led2;
 }
  
-int main() {
-    led2 = 1;
-    flipper.attach(&flip, 2.0); // the address of the function to be attached (flip) and the interval (2 seconds)
+void flip3() {
+    led3 = !led3;
+}
+ 
+void flip4() {
+    led4 = !led4;
+}
  
-    // spin in a main loop. flipper will interrupt it to call flip
-    while(1) {
-        led1 = !led1;
-        wait(0.2);
-    }
+int main() {
+    led1 = 0;
+    led2 = 0;
+    led3 = 0;
+    led4 = 0;
+    
+    flipper1.attach(&flip1, 8.0); // the address of the function to be attached (flip1) and the interval (8 seconds)
+    flipper2.attach(&flip2, 4.0); // the address of the function to be attached (flip2) and the interval (4 seconds)
+    flipper3.attach(&flip3, 2.0); // the address of the function to be attached (flip3) and the interval (2 seconds)
+    flipper4.attach(&flip4, 1.0); // the address of the function to be attached (flip4) and the interval (1 seconds)
 }
\ No newline at end of file
diff -r 5014bf742e9b -r adae4a00fbfe mbed.bld
--- a/mbed.bld	Thu Feb 14 14:30:22 2013 +0000
+++ b/mbed.bld	Tue Oct 16 00:23:53 2018 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/0954ebd79f59
\ No newline at end of file
+https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187
\ No newline at end of file