//FAB TINY-PIANO - ARDUINO UNO BOARD//

#define keyboard_AnalogInput 5 //INPUT PIN//

#define btn1 1
#define btn2 2
#define btn3 3
#define btn4 4
#define btnNONE 0

int var= 0;
int buttonPressed;

// CONFIGURATION//

void setup(){

Serial.begin(9600);
Serial.println("Test FAB TINY-PIANO"); //Serial monitor test´s title//

}

//LOOP//

void loop(){
buttonPressed = read_keyboard();
if (buttonPressed != btnNONE)
{
Serial.print("You PRESSED "); //message when button pressed//
Serial.println(buttonPressed);
}
delay(150);
}
int read_keyboard(){

var = analogRead(keyboard_AnalogInput);

if (var > 1000) return btnNONE;

/*NOTE CONFIGURATION

tone(output pin,frecuency,duration)*/



tone(6,294,500); if (var < 194) return btn1;
tone(6,440,500); if (var < 380) return btn2;
tone(6,493,500); if (var < 555) return btn3;
tone(6,392,500); if (var < 790) return btn4;
}

/*NOTES:

NOTE: FRECUENCY:

c 261 Hz
d 294 Hz
e 329 Hz
f 349 Hz
g 392 Hz
a 440 Hz
b 493 Hz
C 523 Hz
*/