SHARE
TWEET

Untitled

a guest Jan 24th, 2020 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Keyboard.h>;
  2.  
  3. int buttonPin1 = 10;
  4. int buttonPin2 = 16;
  5. int buttonPin3 = 11;
  6. int buttonPin4 = 15;
  7. int delayer = 200;
  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. digitalWrite(buttonPin1, HIGH);
  18. digitalWrite(buttonPin2, HIGH);
  19. digitalWrite(buttonPin3, HIGH);
  20. digitalWrite(buttonPin4, HIGH);
  21. }
  22.  
  23. void loop() {
  24.   if (digitalRead(buttonPin1) == 0)
  25.   {
  26.   Keyboard.write('w');
  27.   delay(delayer);
  28.   }
  29.     if (digitalRead(buttonPin2) == 0)
  30.   {
  31.   Keyboard.write('a');
  32.   delay(delayer);
  33.   }
  34.     if (digitalRead(buttonPin3) == 0)
  35.   {
  36.   Keyboard.write('s');
  37.   delay(delayer);
  38.   }
  39.     if (digitalRead(buttonPin4) == 0)
  40.     {
  41.   Keyboard.write('d');
  42.   delay(delayer);
  43.   }
  44.  
  45. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top