UoD_ME21001_Group_1_16 / Mbed 2 deprecated Exercise1

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
loicb2000
Date:
Tue Oct 08 16:42:37 2019 +0000
Commit message:
Exercise 1a

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
--- /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
+    }
+  }
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Oct 08 16:42:37 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file