Jump to content
43oh

Launchpad+Accelerometer+Processing=Snake game!!!


Recommended Posts

I made this little project and wanted to share it. The code is mostly from "Half Duplex Software UART on the LaunchPad" by NJC, I just added the ADC parts I needed. The Processing application send first a "X" and the LP answer with the value from one of the axes, then send a "Y" and you get the value from the other axis. After that the soft update the snake position and repeat the process. In order to start the game you have to click on the START button (pretty obvious), you lose if the snake touchs any of the sides, also the length and speed increase as you eat the little boxes.

The codes are far from perfect and can be improved. I'm making a little video (that actually took me almost the same amount of time I spent programming) and I'll upload it in a while.

 

 

EDIT:here is the video

Launchpad-Snake.rar

Link to post
Share on other sites
Thats awesome!!

to bad i dont have an extra accelerometer.

thanks!! well the accelerometer it's just one possibility, you could hook up any other device to both ADC channels to control the snake, in fact...that could be a nice challenge: make new,differents and funny ways to play!!!

Link to post
Share on other sites
...like a joystick.

Wow, that's pretty retro of you, bluehash!

 

Why not a web-based, mobile-enabled app that controls intensity of a blue and a green laser to run the game via CdS cells from 100m away? :lol:

 

Truth be told, I have a bunch of joysticks, but all microswitch-based for the MAME cabinet I was building (note: I did not write "built", as in "finished").

 

Nice job, juani_c, and the music is great! I checked out the site you credited and found some more I liked. :D

Link to post
Share on other sites
  • 2 weeks later...
l the accelerometer it's just one possibility, you could hook up any other device to both ADC channels to control the snake,

...like a joystick.

 

Why spend 4+shipping on that, when you can gut an old analog ps controller. Hell, you can buy them new for 5 bucks, and you get two plus other bits.

Link to post
Share on other sites
...you can gut an old analog ps controller.

I just did that very thing for some rumble motors.

 

Total from one controller: 2 rumble motors (1 with smaller weight, 1 larger), 2 analog joysticks with push switch, 2 small PCBs with traces for silicone type buttons (and the contacts for them), a few through-hole capacitors, a bunch of surface-mount devices (including some that look like inductors), cable with USB-A end.

 

I love when I can scrounge usable parts!

Link to post
Share on other sites
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...