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.

Code

#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);

//Serial.begin();
Keyboard.begin();
}

void loop() {

//keyboard button presses
if (digitalRead(upButton) == HIGH) {
Keyboard.press(‘w’); //send UP
delay(100);
}
else if (digitalRead(upButton) == LOW)
Keyboard.release(‘w’);

if (digitalRead(downButton) == HIGH) {
Keyboard.press(‘s’); //send DOWN
delay(100);
}
else if (digitalRead(downButton) == LOW)
Keyboard.release(‘s’);

if (digitalRead(leftButton) == HIGH) {
Keyboard.press(‘a’); //send LEFT
delay(100);
}
else if (digitalRead(leftButton) == LOW)
Keyboard.release(‘a’);

if (digitalRead(rightButton) == HIGH) {
Keyboard.press(‘d’); //send RIGHT
delay(100);
}
else if (digitalRead(rightButton) == LOW)
Keyboard.release(‘d’);

Circuit Design

Fabrication

Materials:

Matboard
Buttons
Wires
Bamboo box
Breadboard

Process:

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

 

Citations

Arduino mouse and keyboard libraries

Arduino mouse button control

149 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

  9. Excellent site. Lots of useful information here. I’m sending it to some buddies
    ans additionally sharing in delicious. And certainly,
    thanks to your effort!

  10. Hi, i think that i saw you visited my site so i came to “return the favor”.I’m trying to find things
    to improve my web site!I suppose its ok to use a few of your ideas!!

  11. Excellent beat ! I wish to apprentice while you amend your site,
    how can i subscribe for a blog site? The account aided me a acceptable deal.

    I had been a little bit acquainted of this your broadcast offered bright clear idea

  12. If some one desires expert view concerning running a blog after that
    i propose him/her to pay a visit this webpage, Keep up the good work.

  13. What’s up to all, how is the whole thing,
    I think every one is getting more from this web page, and your views are
    good designed for new visitors.

  14. scoliosis
    Appreciation to my father who stated to me on the topic of this webpage,
    this blog is actually awesome. scoliosis

  15. free dating sites
    Thanks for a marvelous posting! I seriously
    enjoyed reading it, you’re a great author.I will remember to bookmark your blog and may come back later on. I want to encourage one to continue your great posts, have a nice weekend!
    dating sites

  16. Wonderful goods from you, man. I have consider your stuff previous to and you’re just too magnificent.
    I actually like what you have acquired right here, certainly
    like what you are stating and the way in which during which you are saying
    it. You are making it entertaining and you continue to take
    care of to stay it wise. I can’t wait to read far more from you.
    That is actually a tremendous site.

  17. Hello just wanted to give you a quick heads up.
    The words in your article seem to be running off the screen in Safari.

    I’m not sure if this is a formatting issue or something to do with internet browser compatibility but I thought I’d post to let you know.
    The design and style look great though! Hope you get the problem resolved soon. Many thanks http://cleckleyfloors.com/cialis

  18. I do accept as true with all of the concepts you’ve introduced for your post. They’re very convincing and can definitely work. Still, the posts are very quick for starters. May you please lengthen them a bit from subsequent time? Thank you for the post.

  19. Excellent pieces. Keep posting such kind of info on your site.
    Im really impressed by your blog.
    Hey there, You’ve performed a fantastic job.
    I will certainly digg it and individually recommend to my friends.
    I am sure they will be benefited from this website.

  20. Very nice post. I just stumbled upon your weblog
    and wished to say that I have truly enjoyed surfing around your blog
    posts. After all I will be subscribing to your
    rss feed and I hope you write again soon!

  21. Please let me know if you’re looking for a writer for your site.
    You have some really great posts and I feel I would be a good asset.

    If you ever want to take some of the load off, I’d love to write some content for your
    blog in exchange for a link back to mine.
    Please shoot me an email if interested. Thank you!

  22. I always used to study article in news papers but now as I am a user of net so from now I am using net for content, thanks to
    web.

  23. Hey! This post could not be written any better!
    Reading this post reminds me of my old room mate! He always kept talking about this.
    I will forward this page to him. Pretty sure he will have a
    good read. Thanks for sharing!

  24. Excellent goods from you, man. I have understand your stuff previous to and you’re just
    too magnificent. I actually like what you have acquired here, really like what
    you’re saying and the way in which you say it. You make it entertaining and you still take care of to keep it sensible.
    I cant wait to read much more from you. This is actually a terrific site.

  25. Thanks for a marvelous posting! I really enjoyed reading it, you
    happen to be a great author.I will always bookmark your
    blog and definitely will come back someday. I want to encourage you continue your great job,
    have a nice day!

  26. Play the classic definition guessing game Balderdash without owning the board game. This version of Balderdash is unique to Zoom, so you can call it Zoomerdash. You’ll need at least three players, but the game is best with around five. Kids ages eight and up will have the most fun with this game. If you love train games for kids to play online, GamesGames.com has an excellent selection of these for free! If you enjoyed this collection of Zoom games for kids, please share this post on Pinterest! This website is a resource for those who want to have fun, build self esteem and teach their kids how to lead happier, healthier and more fulfilling lives. https://merabusinesscard.com/community/profile/celinasoderlund/ Where we make this available, you can choose to log in to your King Profile using your account details with a third party network, such as Facebook or Google. If you do this, you will be able to use your account to log in on multiple devices and synchronise progress across those devices. Where available, you will also be able to see which of your friends are playing the same game and their progress through the games (and they will be able to see you and your progress), or access other functionality we make available in our games and other Services, such as inviting friends to play, asking other players for lives and 1-2-1 messaging.

Leave a Reply

Your email address will not be published.