a MIDI-to-Morse code application.

Dependencies:   MIDI REnc button mbed morse

Revision:
7:82910f3806b3
Parent:
6:7405805be717
Child:
8:96f4614a46ba
--- a/main.cpp	Sun Jul 13 09:26:49 2014 +0000
+++ b/main.cpp	Sun Jul 13 10:00:28 2014 +0000
@@ -39,19 +39,24 @@
 int main()
 {
     int i;
+    int mode = 0;
+    int value;
 
-
+    srand( 0 );
     btn.CMD = 0;
     while(1) {
-        for (i = 0; i < 27; i++) {
-
-            if(btn.CMD) {
-                i = 0;
-                btn.CMD = 0;
+        if(btn.CMD) {
+            mode++;
+            btn.CMD = 0;
+        }
+        if (mode % 2) {
+            for (i = 0; i < 27; i++)    morse.code(codes[i]);
+        } else {
+            for (i = 0; i < 5; i++) {
+                value = rand();
+                morse.code(codes[value % 26]);
             }
-
-            morse.code(codes[i]);
-
+            morse.code(codes[26]);
         }
     }
 }