Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. const int SoundPin = 9;
  2. int DelaySound = 500;
  3. void setup() {
  4. }
  5.  
  6. void loop() {
  7. if(digitalRead(2) == LOW){
  8. digitalWrite(7, HIGH);
  9. delay(500);
  10. digitalWrite(7, LOW);
  11. delay(250);
  12. }
  13. if(digitalRead(2) == HIGH){
  14. Sound();
  15. }
  16. }
  17. void Sound(){
  18. tone(SoundPin, 262); // ДО
  19. delay(DelaySound);
  20. tone(SoundPin, 294); //РЕ
  21. delay(DelaySound);
  22. tone(SoundPin, 329);//МИ
  23. delay(DelaySound);
  24. tone(SoundPin, 349);//ФА
  25. delay(DelaySound);
  26. tone(SoundPin, 392);//СОЛЬ
  27. delay(DelaySound);
  28. tone(SoundPin, 440);//ЛЯ
  29. delay(DelaySound);
  30. tone(SoundPin, 494);//СИ
  31. delay(DelaySound);
  32. noTone(9);
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement