 
   int noteDuration = 1000/8;
    
-  char key = kpd.getKey();
-  int reading = digitalRead(key);
-
+  char keyA = kpdA.getKey();
+  char keyB = kpdB.getKey();
   
-  if(key)  // Check for a valid key.
+//  int reading = digitalRead(key);
+
+  
+  if(keyA)  // Check for a valid key.
   {
-    Serial.println(reading);
-    switch (key)
+//    Serial.println(reading);
+    switch (keyA)
     {
       // to calculate the note duration, take one second 
       // divided by the note type.

#include "pitches.h"


const byte ROWS = 4; // Four rows
const byte COLS = 3; // Three columns
// Define the Keymap
char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'#','0','*'}
};
// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
//byte rowPins[ROWS] = { 9, 8, 7, 6 };
// Connect keypad COL0, COL1 and COL2 to these Arduino pins.
//byte colPins[COLS] = { 12, 11, 10 }; 

// REMAPPED CONNECTION
byte rowPins[ROWS] = { 12, 7, 9, 10 };
byte colPins[COLS] = { 11, 8, 6 }; 


// Create the Keypad
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

#define ledpin 13
int motorPin = 2;

        tone(melodyPin, NOTE_B3,noteDuration);
        delay(125);
        tone(melodyPin, NOTE_C3,noteDuration);
        Serial.println("1");
        break;
      case '2':
        tone(melodyPin, NOTE_B3,noteDuration);
        Serial.println("2");
        break;
      case '3':
        tone(melodyPin, NOTE_C4,noteDuration);
        Serial.println("3");
        break;
      case '4':
        tone(melodyPin, NOTE_D4,noteDuration);
        Serial.println("4");
        break;
      case '5':
        tone(melodyPin, NOTE_E4,noteDuration);
        Serial.println("5");
        break;
      case '6':
        tone(melodyPin, NOTE_F4,noteDuration);
        Serial.println("6");
        break;
      case '7':
        tone(melodyPin, NOTE_G4,noteDuration);
        Serial.println("7");
        break;
      case '8':
        tone(melodyPin, NOTE_A4,noteDuration);
        Serial.println("8");
        break;
      case '9':
//        tone(melodyPin, NOTE_B4,noteDuration);
//        int size = sizeof(underworld_melody) / sizeof(int);
        for (int thisNote = 0; thisNote < 8; thisNote++) {
          // to calculate the note duration, take one second
          // divided by the note type.
          //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
