Solution to Task 1.2.1

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
noutram
Date:
Thu Sep 24 12:24:01 2015 +0000
Commit message:
Initial version 24-09-2015

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 000000000000 -r f809b34da5df main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Sep 24 12:24:01 2015 +0000
@@ -0,0 +1,47 @@
+#include "mbed.h"
+
+//This is my solution, using C functions
+//to avoid repetition.
+
+DigitalOut myled(D7);
+
+void flash(double t);
+void dash();
+void dot();
+void symbGap() ;
+
+int main() {
+    while(1) {
+        dot();
+        dot();
+        dot();
+        symbGap();
+        dash();
+        dash();
+        dash();
+        symbGap();
+        dot();
+        dot();
+        dot();
+        wait(5.0);
+    }
+}
+
+void dot() {
+    flash(0.15);
+}
+
+void symbGap() {
+    wait(0.15);
+}
+
+void dash() {
+    flash(0.45);
+}
+
+void flash(double t) {
+    myled = 1;
+    wait(t);
+    myled=0; 
+    wait(0.15);   
+}
\ No newline at end of file
diff -r 000000000000 -r f809b34da5df mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Sep 24 12:24:01 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/da0ca467f8b5
\ No newline at end of file