Slave serial com

Dependencies:   mbed

Fork of Serial_Communication_Slave by Arthur Semjonov

Revision:
1:a1067f80d074
Parent:
0:3457fac208b7
--- a/main.cpp	Tue Feb 18 16:31:38 2014 +0000
+++ b/main.cpp	Tue Feb 18 16:38:12 2014 +0000
@@ -42,7 +42,7 @@
             playTheDoctor();
             wait(0.01);
         } else if (joyDOWN) {
-            playTheCompanion();
+            playTheNote();
             wait(0.01);
         } else if (joyMID) {
             songOfMyPeople(frequency, beat);
@@ -62,7 +62,7 @@
 /*TODO: 1) Figure out what stop() returns, if any
         2) Add print statements to see what is getting sent/received
         Bonus) Implement potentiameters for tempo and pitch */
-void playTheCompanion()
+void playTheNote()
 {
     for (int i=0; i<=8; i++) {
         send_note = frequency[i];
@@ -107,8 +107,8 @@
 {
 
     while(companion.receive()!=0) {
-        send_note = companion.write(addr);
-        playTheCompanion(rec_note);
+        send_note = companion.receive();
+        playTheNote(rec_note);
         if (joyMID) {
             speaker = 0;                    //reset speaker duty cycle
             companion.stop();           //force end condition for both master and companion
@@ -128,7 +128,7 @@
 }
 /*===================================================================*/
 //===================Goon Squad of helper functions==================//
-void playTheCompanion(int k)
+void playTheNote(int k)
 {
     float frqNote = notes[k];
     pc.printf("\n\rFrq of the companion note = '%f", k,