Adapted code from original GT_Tuner code (by Andrew Durand) for a school project by Tapton School.

Dependencies:   mbed

Revision:
1:c8ec50d75f80
Parent:
0:6b0b61d411ad
Child:
2:c242fd25e7e2
diff -r 6b0b61d411ad -r c8ec50d75f80 main.cpp
--- a/main.cpp	Tue Jan 03 13:46:19 2017 +0000
+++ b/main.cpp	Mon Jan 30 13:16:23 2017 +0000
@@ -14,6 +14,7 @@
 DigitalOut led_high(LED4);
 InterruptIn button1(p6); //mosi
 DigitalIn myInputPin (p21); //select tuner or chord learning mode
+Serial device(p28, p27);  // tx, rx to connect to mbed 2
 
 //LCD and Other Random Variables
 //NokiaLCD lcd(p5, p7, p8, p9, NokiaLCD::LCD6610); // mosi, sclk, cs, rst, type
@@ -67,6 +68,7 @@
 }
 
 int main() {
+  device.baud(19200);
   while (1) {
      myInputPin.mode(PullUp);  //set the mbed to use a pullup resistor
      if (myInputPin) { //select guitar tuner or chord teaching
@@ -164,12 +166,19 @@
         int pintwenty = adc.read(p20); //read pin 20
         lcd.locate(0,1);
         lcd.printf("%s %iHz %d\n",key, (int) note, pintwenty);
-        if (led_ok) lcd.printf("Tuner- In Tune");
-        else if (led_low) lcd.printf("Tuner- 2Low   ");
-        else if (led_high) lcd.printf("Tuner- 2High  ");
-        else lcd.printf("~~~~~~~~");
-
-        Counter = 0;
+        if (led_ok) {
+                     lcd.printf("Tuner- In Tune");
+                     device.printf("QT%sN2Z", key);// send to mbed 2
+                     }
+        else if (led_low) {
+                      lcd.printf("Tuner- 2Low   ");
+                      device.printf("QT%sN3Z", key);// send to mbed 2
+                      }
+        else if (led_high){ 
+                      lcd.printf("Tuner- 2High  ");
+                      device.printf("QT%sN1Z", key);// send to mbed 2
+                      }
+         Counter = 0;
         } //inner while (1)loop
       } else {  //if myinputpin
   
@@ -300,12 +309,19 @@
         lcd.printf("%iHz",(int) note); 
         lcd.locate(11,1);
         lcd.printf("%4d\n",pintwenty); //need to deal with lcd screen changes to restrict input decimal range to 4sf
-        if (led_ok) lcd.printf("Play %s->In Tune",key); //if statement here for send green LED pattern for selected chord
-        else if (led_low) lcd.printf("Play %s -> 2Low ",key);//if statement here for send red LED pattern for selected chord
-        else if (led_high) lcd.printf("Play %s -> 2High",key);//if statement here for send red LED pattern for selected chord
-        else lcd.printf("~~~~~~~~");
-
-        Counter = 0;
+        if (led_ok) {
+            lcd.printf("Play %s->In Tune",key);
+            device.printf("QV%sN2Z", key);// send to mbed 2
+            }
+        else if (led_low) {
+            lcd.printf("Play %s -> 2Low ",key);
+            device.printf("QV%sN3Z", key);// send to mbed 2
+            }
+        else if (led_high) {
+            lcd.printf("Play %s -> 2High",key);
+            device.printf("QV%sN1Z", key);// send to mbed 2
+            }
+       Counter = 0;
         }
        }