#include <Keypad.h>
#define buzz 13

const uint8_t ROWS = 4;
const uint8_t COLS = 4;
char keys[ROWS][COLS] = {
 { '1', '2', '3',  },
 { '4', '5', '6',  },
 { '7', '8', '9',  },
 { '*', '0', '#',  }
};

uint8_t colPins[COLS] = { 5, 4, 3, 2 }; // Pins connected to C1, C2, C3, C4
uint8_t rowPins[ROWS] = { 9, 8, 7, 6 }; // Pins connected to R1, R2, R3, R4

Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);

void setup() {
  Serial.begin(9600);
  pinMode(buzz, OUTPUT);
  Serial.println("Press a key");
}
void loop() {
  char presskey = keypad.getKey();
  if (presskey){
    Serial.print("Key pressed");
    Serial.println(presskey);
    if(presskey == '1'){
    digitalWrite(buzz, HIGH);
    delay(100);
    digitalWrite(buzz, LOW);
    delay(100);
    tone(buzz, 250, 200);
    delay(300);
    }
    if(presskey == '2'){
    tone(buzz, 350, 200);
    delay(300);
    }
    if(presskey == '3'){
    tone(buzz, 400, 200);
    delay(300);
    }
    if(presskey == '4'){
    tone(buzz, 450, 200);
    delay(300);
    }
    if(presskey == '5'){
    tone(buzz, 550, 200);
    delay(300);
    }
    if(presskey == '6'){
    tone(buzz, 650, 200);
    delay(300);
    }
    if(presskey == '7'){
    tone(buzz, 750, 200);
    delay(300);
    }
    if(presskey == '8'){
    tone(buzz, 850, 200);
    delay(300);
    }
    if(presskey == '9'){
    tone(buzz, 950, 200);
    delay(300);
    }
  }
}