UoD_ME21001_Group_1_16 / Mbed 2 deprecated Exercise1

Dependencies:   mbed

Revision:
0:580af977fe72
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Oct 08 16:42:37 2019 +0000
@@ -0,0 +1,34 @@
+
+#include "mbed.h"
+
+DigitalOut myled(LED1);  // use onboard LED #1
+
+int main() {
+
+  int mycounter;
+  int flashtimes;
+
+  while(1) {                                                // repeat the program indefinitely
+    for(flashtimes=0;flashtimes<5;flashtimes++) {           // repeat five times
+      for(mycounter=0;mycounter<=flashtimes;mycounter++) {  // repeat 'flashtimes' number
+        myled = 1;                                          // turn on LED #1
+        wait(0.250);                                        // 250ms 'on' time
+        myled = 0;                                          // turn off LED #1
+        wait(0.250);                                        // 250ms 'off' time
+      }
+      wait(1.000);                                          // 1s pause
+    }
+
+    for(flashtimes=5;flashtimes>0;flashtimes--) {           // repeat five times
+      for(mycounter=0;mycounter<flashtimes;mycounter++) {   // repeat 'flashtimes' number
+        myled = 1;                                          // turn on LED #1
+        wait(0.250);                                        // 250ms 'on' time
+        myled = 0;                                          // turn off LED #1
+        wait(0.250);                                        // 250ms 'off' time
+      }
+      wait(1.000);                                          // 1s pause
+    }
+  }
+}
+
+