int count = 9; int randomNumber = 0; const int digitalPin = 12; const int c = 261; const int C = 277; const int d = 297; const int D = 311; const int e = 330; const int f = 349; const int F = 370; const int g = 392; const int G = 415; const int a = 440; void setup() { randomSeed(analogRead(0)); pinMode(12, OUTPUT); } void loop() { if (count < 10) { randomNumber = random(261, 441); tone(digitalPin,randomNumber); count++; delay(1000); } else { noTone(digitalPin); delay(5000); tone(digitalPin, c, 300); delay(500); tone(digitalPin, c, 300); delay(500); tone(digitalPin, g, 300); delay(500); tone(digitalPin, g, 300); delay(500); tone(digitalPin, a, 300); delay(500); tone(digitalPin, a, 300); delay(500); tone(digitalPin, g, 300); delay(1000); tone(digitalPin, f, 300); delay(500); tone(digitalPin, f, 300); delay(500); tone(digitalPin, e, 300); delay(500); tone(digitalPin, e, 300); delay(500); tone(digitalPin, d, 300); delay(500); tone(digitalPin, d, 300); delay(500); tone(digitalPin, c, 300); delay(500); noTone(digitalPin); delay(500); } }