#include "pitches.h"
#define bz 8
int btn = A5;
int note [8]={NOTE_C4,NOTE_DS4,NOTE_E4,NOTE_F4,NOTE_G4,NOTE_A4,NOTE_B4,NOTE_C5};
void setup() {
// put your setup code here, to run once:
pinMode(btn , INPUT);
Serial.begin(115200);
}
void loop() {
int a = analogRead( btn );
a = map(a, 0, 1023, 0, 8);
tone(bz,a);
// put your main code here, to run repeatedly:
}
/*tone(bz,NOTE_C4);
delay(100);
tone(bz,NOTE_C4);
delay(100);
tone(bz,NOTE_G4);
delay(100);
tone(bz,NOTE_G4);
delay(100);
tone(bz,NOTE_A4 );
delay(100);
tone(bz,NOTE_A4 );
delay(100);
tone(bz,NOTE_G4);
delay(100);
tone(bz, NOTE_F4);
delay(100);
tone(bz, NOTE_F4);
delay(100);
tone(bz,NOTE_E4 );
delay(100);
tone(bz,NOTE_E4 );
delay(100);
tone(bz,NOTE_DS4);
delay(100);
tone(bz,NOTE_DS4);
delay(100);
tone(bz,NOTE_C4);
delay(100);
}
*/