Advertisement
Guest User

Untitled

a guest
Jan 24th, 2020
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #include <Keyboard.h>;
  2.  
  3. int buttonPin1 = 10;
  4. int buttonPin2 = 16;
  5. int buttonPin3 = 14;
  6. int buttonPin4 = 15;
  7. int delayer = 40;
  8.  
  9.  
  10. void setup()
  11. {
  12. Serial.begin(9600);
  13. pinMode(buttonPin1, INPUT);
  14. pinMode(buttonPin2, INPUT);
  15. pinMode(buttonPin3, INPUT);
  16. pinMode(buttonPin4, INPUT);
  17. Keyboard.begin();
  18. }
  19.  
  20. void loop() {
  21. if (digitalRead(buttonPin1) == 0)
  22. {
  23. Keyboard.press('w');
  24. }
  25. else
  26. {
  27. Keyboard.release('w');
  28. }
  29.  
  30.  
  31. if (digitalRead(buttonPin2) == 0)
  32. {
  33. Keyboard.press('a');
  34. }
  35. else
  36. {
  37. Keyboard.release('a');
  38. }
  39.  
  40.  
  41. if (digitalRead(buttonPin3) == 0)
  42. {
  43. Keyboard.press('s');
  44. }
  45. else
  46. {
  47. Keyboard.release('s');
  48. }
  49.  
  50.  
  51. if (digitalRead(buttonPin4) == 0)
  52. {
  53. Keyboard.press('d');
  54. }
  55. else
  56. {
  57. Keyboard.release('d');
  58. }
  59.  
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement