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

mnf
Valued Contributor
Valued Contributor
Posts: 493
Joined: Wed May 31, 2017 11:57 am
Has thanked: 52 times
Been thanked: 278 times
Contact:

Christmas Project 2018

Postby mnf » Mon Dec 24, 2018 9:51 pm

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.82 KiB) Downloaded 40 times

(Snakums to avoid Nokia suing me?)

Happy Christmas

Martin

Fame (though unlikely fortune) awaits the first 'pong' game for the same hardware setup :-)
These users thanked the author mnf for the post (total 2):
medelec35 (Mon Dec 24, 2018 10:10 pm) • jgu1 (Tue Dec 25, 2018 7:09 pm)
Rating: 11.11%
 

mnf
Valued Contributor
Valued Contributor
Posts: 493
Joined: Wed May 31, 2017 11:57 am
Has thanked: 52 times
Been thanked: 278 times
Contact:

Re: Christmas Project 2018

Postby mnf » Wed Dec 26, 2018 6:08 pm

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: 8330
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2381 times
Been thanked: 3393 times
Contact:

Re: Christmas Project 2018

Postby medelec35 » Wed Dec 26, 2018 7:18 pm

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: 493
Joined: Wed May 31, 2017 11:57 am
Has thanked: 52 times
Been thanked: 278 times
Contact:

Re: Christmas Project 2018

Postby mnf » Wed Dec 26, 2018 7:27 pm

Should be now - got stuck at 89% for a long time!
These users thanked the author mnf for the post:
medelec35 (Thu Dec 27, 2018 1:08 pm)
Rating: 5.56%