Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Keyboard.h>;
- int buttonPin1 = 10;
- int buttonPin2 = 16;
- int buttonPin3 = 14;
- int buttonPin4 = 15;
- int delayer = 40;
- void setup()
- {
- Serial.begin(9600);
- pinMode(buttonPin1, INPUT);
- pinMode(buttonPin2, INPUT);
- pinMode(buttonPin3, INPUT);
- pinMode(buttonPin4, INPUT);
- Keyboard.begin();
- }
- void loop() {
- if (digitalRead(buttonPin1) == 0)
- {
- Keyboard.press('w');
- }
- else
- {
- Keyboard.release('w');
- }
- if (digitalRead(buttonPin2) == 0)
- {
- Keyboard.press('a');
- }
- else
- {
- Keyboard.release('a');
- }
- if (digitalRead(buttonPin3) == 0)
- {
- Keyboard.press('s');
- }
- else
- {
- Keyboard.release('s');
- }
- if (digitalRead(buttonPin4) == 0)
- {
- Keyboard.press('d');
- }
- else
- {
- Keyboard.release('d');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement