Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Keyboard.h>
- const int buttonS = 7;
- const int buttonD = 8;
- int led1 = 3;
- int led2 = 4;
- void setup() {
- pinMode(led1, OUTPUT);
- pinMode(led2, OUTPUT);
- pinMode(buttonS, INPUT_PULLUP);
- pinMode(buttonD, INPUT_PULLUP);
- Keyboard.begin();
- }
- void loop() {
- if (digitalRead(buttonS) == LOW)
- {
- Keyboard.press('s');
- digitalWrite(led1, LOW);
- }
- else
- {
- Keyboard.release('s');
- digitalWrite(led1, HIGH);
- }
- if (digitalRead(buttonD) == LOW)
- {
- Keyboard.press('d');
- digitalWrite(led2, LOW);
- }
- else
- {
- Keyboard.release('d');
- digitalWrite(led2, HIGH);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement