Bluetooth Enabled Keyboard/Synthesizer for mbed

Dependencies:   mbed 4DGL-uLCD-SE SDFileSystem mbed-rtos

Revision:
13:25d53936d385
Parent:
12:d60a9d0052a7
Child:
14:40f57385c404
--- a/main.cpp	Fri Apr 29 22:28:48 2016 +0000
+++ b/main.cpp	Fri Apr 29 22:33:43 2016 +0000
@@ -563,49 +563,41 @@
     Blue.attach(&parse_message,Serial::RxIrq);  //attach interrupt function for each new Bluetooth serial character
     while(1) {
         //check for a new button message ready
-        if((keyPress == C_NOTE_KEY) && (readyFlag)){        // button Z pressed
+        if((keyPress == C_NOTE_KEY) && (readyFlag)){        // Play note C
             set_Note_Freq(noteArray[currentOctave-1][0]);   // set the note frequency to the proper value 
-            create_samples(noteFreq, myWave);
-            write_to_SDCard('C');
-            readyFlag = false;
-            // Play note that corresponds to Z
+            create_samples(noteFreq, myWave);               // creates the samples that are going to be output to the waveform
+            write_to_SDCard('C');                           // writes to the SD card
+            readyFlag = false;                              // set this flag to false so that the program will not try to process the key press more than once
+            
         }
-        else if((keyPress == D_NOTE_KEY) && (readyFlag)){ // button X pressed
+        else if((keyPress == D_NOTE_KEY) && (readyFlag)){ // Play note D
                 set_Note_Freq(noteArray[currentOctave-1][1]);
                 create_samples(noteFreq, myWave);
                 write_to_SDCard('D');
                 readyFlag = false;
-            // Play note that corresponds to X
+            
         }
-        else if((keyPress == E_NOTE_KEY) && (readyFlag)){ // button C pressed
+        else if((keyPress == E_NOTE_KEY) && (readyFlag)){ // Play note E
             set_Note_Freq(noteArray[currentOctave-1][2]);
             create_samples(noteFreq, myWave);
-            // Play note that corresponds to C
-            // Make note of which note was played in file on SD Card
             write_to_SDCard('E');
             readyFlag = false;
         }
-        else if((keyPress == F_NOTE_KEY) && (readyFlag)){ // button V pressed
+        else if((keyPress == F_NOTE_KEY) && (readyFlag)){ // Play note F
             set_Note_Freq(noteArray[currentOctave-1][3]);
             create_samples(noteFreq, myWave);
-            // Play note that corresponds to V
-            // Make note of which note was played in file on SD Card
             write_to_SDCard('F');
             readyFlag = false;
         }
-        else if((keyPress == G_NOTE_KEY) && (readyFlag)){ // button B pressed
+        else if((keyPress == G_NOTE_KEY) && (readyFlag)){ // Play note G
             set_Note_Freq(noteArray[currentOctave-1][4]);
             create_samples(noteFreq, myWave);
-            // Play note that corresponds to B
-            // Make note of which note was played in file on SD Card
             write_to_SDCard('G');
             readyFlag = false;
         }
-        else if((keyPress == A_NOTE_KEY) && (readyFlag)){ // button N pressed
+        else if((keyPress == A_NOTE_KEY) && (readyFlag)){ // Play note A
             set_Note_Freq(noteArray[currentOctave][5]);
             create_samples(noteFreq, myWave);
-            // Play note that corresponds to N
-            // Make note of which note was played in file on SD Card
             write_to_SDCard('A');
             readyFlag = false;
         }