Advertisement
computermuseo

pianola musicale arduino

Apr 24th, 2015
3,457
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. void setup() {
  2.  
  3. pinMode(3, INPUT);
  4. pinMode(4, INPUT);
  5. pinMode(5, INPUT);
  6. pinMode(6, INPUT);
  7. pinMode(7, INPUT);
  8. pinMode(2,OUTPUT);
  9. }
  10.  
  11. void loop() {
  12. int switch1 = digitalRead(3);
  13. int switch2 = digitalRead(4);
  14. int switch3 = digitalRead(5);
  15. int switch4 = digitalRead(6);
  16. int switch5 = digitalRead(7);
  17. if(switch1==HIGH)
  18. tone(2,3000,100);
  19. if(switch2==HIGH)
  20. tone(2,2500,100);
  21. if(switch3==HIGH)
  22. tone(2,2000,100);
  23. if(switch4==HIGH)
  24. tone(2,1500,100);
  25. if(switch5==HIGH)
  26. tone(2,1000,100);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement