r/ArduinoProjects • • Feb 23 '22

Mini snake game on OLED display

176 Upvotes

12 comments sorted by

3

u/SkunkaMunka Feb 23 '22

Awesome. You should implement controls with a joystick module

2

u/dackss_ Feb 24 '22

Not a bad idea. I just used some pushbuttons I had lying around but figuring out how to use a joystick might be interesting.

2

u/SkunkaMunka Feb 24 '22

That's the next step. All the best

3

u/bmitov Feb 23 '22

Very cool! :-) You should post a tutorial on the project on Instructables or some of the other tutorial sites.

3

u/dackss_ Feb 24 '22

Thanks! Idk about a tutorial, I kinda just put it together for fun and the wiring and code are a bit of a mess. Glad you liked it though.

2

u/bmitov Feb 24 '22

No worries... I really like the way the game looks! :-) . Especially with the "2 color" OLED ;-)

2

u/eyeoverthink Feb 24 '22

Is this your personal code? Or, is it open sourced?

2

u/dackss_ Feb 24 '22

Personal code. I had a hard time initially figuring out the logic of snake so I did some research on that but I implemented the actual code myself. It was actually rather interesting to learn about and involved using 2D arrays which I haven't worked with before. So I guess you could say I made it just with a bit of reference to point me in the right direction.

2

u/eyeoverthink Feb 24 '22

Nice job. I'd love to look it over and see if I can disect it for my 8x8x8 led box I made.

1

u/dackss_ Feb 24 '22

Well I'm kinda new at this but I just quickly uploaded the code to Github. The main code is in OLED_Snake but I also made a mini button library and included that just in case. Sorry I didn't add comments or anything, I just grabbed the code I used without editing it or anything. If want to try and poke around in it feel free and let me know if you have questions, I'll see if I can decipher my code. Also honestly I would probably just suggest reading the post I found explaining how to code it, it would probably be more useful.

My code: https://github.com/DaxtonL/OLED_Snake

The snake post: https://www.quora.com/What-is-the-logic-behind-a-snake-game-from-a-programming-point-of-view

2

u/eyeoverthink Feb 24 '22

Thank you for sharing, I'll give you your credit for the code influence and update things if I improve anything.

1

u/Mobima May 30 '22

How does it feel to suck at your own game?

Cool project tho.