Jump to content
Sign in to follow this  
juani_c

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

Share this post


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!!!

Share this post


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

Share this post


Link to post
Share on other sites
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.

Share this post


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!

Share this post


Link to post
Share on other sites

I like it a lot! Can you tell a bit more what Accelerometer chip you used and how did you connected to Launchpad? Connecting Accelerometer to Launchpad is in one of my next things to do :)

Share this post


Link to post
Share on other sites
I like it a lot! Can you tell a bit more what Accelerometer chip you used and how did you connected to Launchpad? Connecting Accelerometer to Launchpad is in one of my next things to do :)

Seed Studio is now selling an accelerometer on a breakout board for US$15: LINK

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×