November 23, 2025
Description
This is my 3D printed WASD Keyboard.
Parts needed:
Wirering:
[Switch W] ───── Pin 2
└──────── GND
[Switch A] ───── Pin 3
└──────── GND
[Switch S] ───── Pin 4
└──────── GND
[Switch D] ───── Pin 5
└──────── GND
Code:
#include <Keyboard.h>
const int wPin = 2;
const int aPin = 3;
const int sPin = 4;
const int dPin = 5;
void setup() {
pinMode(wPin, INPUT_PULLUP);
pinMode(aPin, INPUT_PULLUP);
pinMode(sPin, INPUT_PULLUP);
pinMode(dPin, INPUT_PULLUP);
Keyboard.begin();
}
void loop() {
// W
if (!digitalRead(wPin))
Keyboard.press('w');
else
Keyboard.release('w');
// A
if (!digitalRead(aPin))
Keyboard.press('a');
else
Keyboard.release('a');
// S
if (!digitalRead(sPin))
Keyboard.press('s');
else
Keyboard.release('s');
// D
if (!digitalRead(dPin))
Keyboard.press('d');
else
Keyboard.release('d');
}
License:
Standard Digital File License