Piano (Arduino UNO R3)


1)
2)

#define DO 262
#define RE 294
#define MI 329
#define FA 349
#define SOL 392
#define LA 440
#define SI 494
int notas[7] = {DO,RE,MI,FA,SOL,LA,SI};
void setup() {
for (int i=2; i<9; i++)
pinMode(i, INPUT);
}
void loop() {
for (int i=2; i<9; i++)
{
while (!digitalRead(i))
{
tone (12, notas [i-2]);
}
noTone (12);
}
}