Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int SoundPin = 9;
- int DelaySound = 500;
- void setup() {
- }
- void loop() {
- if(digitalRead(2) == LOW){
- digitalWrite(7, HIGH);
- delay(500);
- digitalWrite(7, LOW);
- delay(250);
- }
- if(digitalRead(2) == HIGH){
- Sound();
- }
- }
- void Sound(){
- tone(SoundPin, 262); // ДО
- delay(DelaySound);
- tone(SoundPin, 294); //РЕ
- delay(DelaySound);
- tone(SoundPin, 329);//МИ
- delay(DelaySound);
- tone(SoundPin, 349);//ФА
- delay(DelaySound);
- tone(SoundPin, 392);//СОЛЬ
- delay(DelaySound);
- tone(SoundPin, 440);//ЛЯ
- delay(DelaySound);
- tone(SoundPin, 494);//СИ
- delay(DelaySound);
- noTone(9);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement