Advertisement
Guest User

Untitled

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