Advertisement
Guest User

Untitled

a guest
Dec 20th, 2019
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. int spin = 4; //speaker pin
  2.  
  3. void alarm(){
  4. for(int hz = 440; hz < 1000; hz++){
  5. tone(spin, hz, 50);
  6. delay(1);
  7. }
  8. noTone(spin);
  9.  
  10. for(int hz = 1000; hz > 440; hz--){
  11. tone(spin, hz, 50);
  12. delay(1);
  13. }
  14. noTone(spin);
  15. }
  16.  
  17. void setup() {
  18. // put your setup code here, to run once:
  19. pinMode(spin,OUTPUT); //beeper
  20. pinMode(5,OUTPUT); //sw
  21. digitalWrite(5,HIGH);
  22. alarm();
  23. alarm();
  24. digitalWrite(5,LOW);
  25. }
  26.  
  27. void loop() {
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement