Can't figure out this one, my Multi-dimensional Array doesn't work.

Dependencies:   SLCD TSI mbed

Fork of slider_diatonic_v1_HW6_2-ChangingOctaves by David Estrada

Revision:
4:de991c90af6a
Parent:
3:f68e9cdfaf2d
Child:
5:d7747f156e9a
--- a/slider_diatonic_v1.cpp	Wed Feb 18 15:27:17 2015 +0000
+++ b/slider_diatonic_v1.cpp	Mon Feb 23 04:49:39 2015 +0000
@@ -26,10 +26,14 @@
 Serial pc(USBTX, USBRX);
 
 float diatonicScale[NUMTONES] = {246.94, 261.63,293.66,329.63,349.23,392.00,440.00,493.88,523.25,587.33};
+float diatonicScale2[NUMTONES] ={493.88, 523.25,587.33,659.25,698.46,783.99,880.00,987.77,1046.50,1174.66};
 SLCD slcd; //define LCD display
 
 TSISensor tsiScaling; // Capacitive sensor/slider
 
+// changes
+DigitalIn RtButton(PTC3); // make RIGHT button interrrupt
+int RtbuttonState; // switch changes when RtButton is pressed
 
 PwmOut led(LED_RED);
 DigitalOut outPin(PTC9); //J1-16
@@ -58,7 +62,11 @@
 */
     scaleIndex = (int)(NUMTONES * scaling);
     if (scaleIndex != oldScaleIndex) {
+        if(RtbuttonState == false){
         toneFreq = diatonicScale[scaleIndex];
+        } else {
+        toneFreq = diatonicScale2[scaleIndex];
+        }
         tonePeriod = 1.0/toneFreq;  
         soundOut.period(tonePeriod); // adjusting period
         soundOut.write(TONEON); // there is a setup time for both period and DF
@@ -100,6 +108,9 @@
     dataTimer.reset(); 
      
     while (true) {
+        
+        RtbuttonState = RtButton; // button is pulled up so false is when button is pushed it's inverted to avoid confusion downstream
+        
         if (dataTimer.read_ms() > DATATIME){ // check to see if enough time has passed
                                             // to read the touch pad
             tempValue = tsiScaling.readPercentage();