Game Controller

For this assignment, I created a game controller to play Atari’s Lunar Lander game in a browser. Using buttons, the controller sends W(up), S(down), A(left) and D(right) keypresses as a USB keyboard.

I used the MKR1000 board for this assignment. The device uses bluetooth connection but I connected it via USB directly to the computer for power and connection.


#include “Keyboard.h”

const int upButton = 7;
const int downButton = 8;
const int leftButton = 6;
const int rightButton = 9;
//const int reloadButton = 4;
//const int enterButton = 5;
void setup () {
pinMode(upButton, INPUT);
pinMode(downButton, INPUT);
pinMode(leftButton, INPUT);
pinMode(rightButton, INPUT);
// pinMode(reloadButton, INPUT);
// pinMode(enterButton, INPUT);


void loop() {

//keyboard button presses
if (digitalRead(upButton) == HIGH) {‘w’); //send UP
else if (digitalRead(upButton) == LOW)

if (digitalRead(downButton) == HIGH) {‘s’); //send DOWN
else if (digitalRead(downButton) == LOW)

if (digitalRead(leftButton) == HIGH) {‘a’); //send LEFT
else if (digitalRead(leftButton) == LOW)

if (digitalRead(rightButton) == HIGH) {‘d’); //send RIGHT
else if (digitalRead(rightButton) == LOW)

Circuit Design



Bamboo box


Solder header pins to the MKR1000
Solder wires to the 4 buttons
Connect the buttons and MRK1000 to breadboard



Arduino mouse and keyboard libraries

Arduino mouse button control

90 thoughts on “Game Controller”

  1. I happen to be writing to make you understand what a terrific experience our princess went through visiting yuor web blog. She realized such a lot of things, with the inclusion of what it is like to possess an incredible teaching style to make the others without hassle thoroughly grasp various tricky topics. You undoubtedly surpassed visitors’ expected results. Thanks for showing those valuable, trustworthy, revealing not to mention unique tips on your topic to Sandra.

  2. Thank you for each of your hard work on this web page. My aunt really likes going through investigations and it’s really obvious why. Most of us learn all of the lively method you offer practical strategies through this web site and even increase participation from some other people on the issue so our favorite girl is in fact learning a lot of things. Take advantage of the rest of the year. You are always doing a really good job.

  3. I am glad for writing to make you know what a notable encounter my wife’s girl had studying your web site. She mastered several pieces, which include what it’s like to possess an awesome helping nature to let other individuals with ease know precisely some problematic subject matter. You truly exceeded people’s expectations. Thank you for producing these practical, trusted, informative and in addition fun tips about this topic to Kate.

  4. Hey there! I could have sworn I’ve been to this site before but after browsing through some of the post I realized it’s new to me.

    Nonetheless, I’m definitely delighted I found it and I’ll
    be bookmarking and checking back frequently! asmr 0mniartist

  5. Greate pieces. Keep posting such kind of info on your page.
    Im really impressed by your site.
    Hi there, You have done an excellent job. I will certainly digg it and individually suggest to my friends.
    I am confident they’ll be benefited from this site.

    0mniartist asmr

  6. Hello there! This is my 1st comment here so I just wanted to give a quick shout out and tell you I
    truly enjoy reading through your posts. Can you recommend any other blogs/websites/forums that go over the same subjects?
    Thank you so much! 0mniartist asmr

  7. This is my first time pay a visit at here and i am actually pleassant to read
    everthing at alone place. asmr 0mniartist

  8. Good day! I know this is kinda off topic but I’d figured I’d ask.
    Would you be interested in exchanging links or maybe guest writing a blog article or vice-versa?
    My blog covers a lot of the same topics as yours and I
    think we could greatly benefit from each other. If you’re interested feel free to send me an e-mail.
    I look forward to hearing from you! Superb blog by the way!
    0mniartist asmr

Leave a Reply

Your email address will not be published.