Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.11 KB | None | 0 0
  1. #include <Joystick.h>
  2. void setup() {
  3.  
  4. pinMode(8, INPUT_PULLUP);
  5. pinMode(7, INPUT_PULLUP);
  6.  
  7. Joystick.begin();
  8. }
  9.  
  10. void loop() {
  11.  
  12. // button 2 should be front finger, button 3 should be side thumb
  13.  
  14. if (digitalRead(8) == LOW) //this is the number on the Arduino chip
  15. {
  16. Joystick.setButton(1, 1);//this is the number you change to invert the switch
  17. }
  18. else
  19. {
  20. Joystick.setButton(1, 0);//this number needs to be change to the oposite of the number above
  21. }
  22.  
  23. if (digitalRead(9) == LOW) //this is the number on the Arduino chip
  24. {
  25. Joystick.setButton(2, 1); //this is the number you change to invert the switch
  26. }
  27. else
  28. {
  29. Joystick.setButton(2, 0); //this number needs to be change to the oposite of the number above
  30. }
  31. delay(1);
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement