Christmas Project 2018

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

Post Reply
mnf
Valued Contributor
Valued Contributor
Posts: 728
Joined: Wed May 31, 2017 11:57 am
Contact:

Christmas Project 2018

Post by mnf »

Here is a little project for Christmas.

Should be able to build it while the turkey (beef or nut roast (delete as appropriate)) cooks. Will keep the kids happy until the queens speech :D

You'll need 16 8x8 Max7219 displays (I used a single 32 x 32 display (16 MAX7219s) - but you can use 4 x 4 or 16 x 1) I used standard jumpers - and could only set the brightness to 0 - but more current would allow other settings to sear your retinas)
A Joystick or some buttons
Some jumpers
A power source for the display
An Arduino (I used a Nano) - should be easy enough to modify for other MCUs - might need to adjust some array sizes to allow for available RAM

Connect the MAX7219 displays into a 32x32 LED screen. (I used D3-D5)
Connect the display to the MCU and to power (add a common ground)
Connect the joystick or buttons to the MCU (get the pins from the component properties) (I used A2 and D2) (All pins in Arduino speak)
Connect power to the display and joystick. (I used 5v pin on Arduino for the joystick and a separate supply for the display - and connected the ground to the Arduino Gnd pin as well)

Upload and game on!

I'll post a video on youtube !

There is plenty of scope for enhancement:
Sound
Animated 'attract' mode
Animated game over/high score screen
Speeds might need tweaking (I like it fairly slow - younger readers might cope with smaller delays in GameLoop) Some different levels would be good - you can only go for until you die.... My high score is 101!

I struggled slightly to get the joystick button to restart the game - it seems to have a bit of a wobbly for the first few plays (just restarts without pressing) - but then settles down. I avoided interrupts here - partly for maximum portability and ease of modification, and partly because I couldn't get it to work with joystick I have (from a 37 sensor pack!)
snakums.fcfx
(65.71 KiB) Downloaded 106 times
(Snakums to avoid Nokia suing me?)

Happy Christmas

Martin

Fame (though unlikely fortune) awaits the first 'pong' game for the same hardware setup :-)

mnf
Valued Contributor
Valued Contributor
Posts: 728
Joined: Wed May 31, 2017 11:57 am
Contact:

Re: Christmas Project 2018

Post by mnf »

Posted a video of the display at

https://youtu.be/6XqIyUj_M1Q

Showing "Conway's Game of Life".

Sorry 'bout the quality of the video - but making good quality video isn't easy! Will have to practice a bit more! (and get a tripod)

Martin

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8876
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Christmas Project 2018

Post by medelec35 »

Hi Martin,
It states video is unavailable.
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

mnf
Valued Contributor
Valued Contributor
Posts: 728
Joined: Wed May 31, 2017 11:57 am
Contact:

Re: Christmas Project 2018

Post by mnf »

Should be now - got stuck at 89% for a long time!

Post Reply