Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <toneAC.h>
  2.  
  3. const int buzzerPin = 8;
  4. const int button1Pin = 9;
  5. const int button2Pin = 10;
  6. const int button3Pin = 11;
  7.  
  8. void setup() {
  9. pinMode (buzzerPin, OUTPUT);
  10. pinMode (button1Pin, INPUT);
  11. pinMode (button2Pin, INPUT);
  12. pinMode (button3Pin, INPUT);
  13. // put your setup code here, to run once:
  14.  
  15. }
  16.  
  17. void loop(){
  18. // put your main code here, to run repeatedly:
  19. int button1State = digitalRead (button1Pin);
  20. if (button1State == 1) {
  21. // button 1 pressed
  22. toneAC (60);
  23. delay (10000);
  24. }
  25.  
  26. int button2State = digitalRead (button2Pin);
  27. if (button2State == 2) {
  28. //button 2 pressed
  29. toneAC (100);
  30. delay (10000);
  31. }
  32. int button3State = digitalRead (button3Pin);
  33. if (button2State == 3);{
  34. //button 3 pressed
  35. toneAC (150);
  36. delay (10000);
  37. }
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement