/*17/10
RYAN LIMA DE OLIVEIRA SANTOS
MATRIZ E TABELA
*/
//========================DEFINIR PINOS===========
#define BUZZ 2
//========================BIBLIOTECAS=============
//=======================VARIÁVEIS E TABELAS============
byte leitura;
int musica[64]={392,0,392,0,455,0,523,0,392,0,392,0,349,0,370,392,0,392,0,455,0,523,0,392,0,392,0,349,0,370,0,392,0,392,392,392,0,455,0,392,0,293,293,293,0,455,0,392,0,277,277,277,0,433,0,392,0,261,261,261,0,233,0,261,0};
//===========================SUB-ROTINAS==========
//=============================SETUP=================
void setup(){
pinMode(BUZZ,OUTPUT);
Serial.begin(9600);
//================================CONDIÇÕES INICIAIS============
Serial.println("OLA MUNDO");
}
//==========================LOOOP INFINITO=================
void loop(){
if(Serial.available()>0) {leitura=Serial.read();}
if(leitura=='A'||leitura=='1') {tone(BUZZ,392);
delay(150);noTone(BUZZ);}
if(leitura=='B'||leitura=='2') {tone(BUZZ,455);
delay(150);noTone(BUZZ);}
if(leitura=='C'||leitura=='3') {tone(BUZZ,523);
delay(150);noTone(BUZZ);}
if(leitura=='D'||leitura=='4') {tone(BUZZ,349);
delay(150);noTone(BUZZ);}
if(leitura=='E'||leitura=='5') {tone(BUZZ,370);
delay(150);noTone(BUZZ);}
if(leitura=='F'||leitura=='6') {tone(BUZZ,293);
delay(150);noTone(BUZZ);}
if(leitura=='G'||leitura=='7') {tone(BUZZ,233);
delay(150);noTone(BUZZ);}
if(leitura=='H'||leitura=='8') {tone(BUZZ,277);
delay(150);noTone(BUZZ);}
if(leitura=='I'||leitura=='9') {tone(BUZZ,261);
delay(150);noTone(BUZZ);}
if(leitura=='X'||leitura==' ') {
delay(150);noTone(BUZZ);}
}