DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. Snake Game on the FRDM-KL25Z with Nokia 5110 Display

Snake Game on the FRDM-KL25Z with Nokia 5110 Display

Erich Styger user avatar by
Erich Styger
·
Jul. 07, 14 · Interview
Like (0)
Save
Tweet
Share
7.67K Views

Join the DZone community and get the full member experience.

Join For Free

so i have a graphics driver for a nokia display (see “ zero cost 84×48 graphical lcd for the freedom board “), i have a joystick shield (see “ joystick shield with the frdm board “) and i do have a freescale freedom board: why not creating a simple game for it? snake!

snake game with frdm-kl25z board

snake game with frdm-kl25z board

my first mobile phone was a nokia with a 84×48 black/white display, and i loved it for many reasons, including having the ‘snake’ game (see http://en.wikipedia.org/wiki/snake_%28video_game%29 ). an arm cortex m0+ is way overpowered for that simple game, still it is fun to make and game it :-).

the game is very simple: a snake is running around, and i can control it with the cursor/joystick with up, down, left and right. the snake has to ‘eat’ the ‘food’, and the snake gets longer the more food is eaten. but the snake shall *not* touch the outside border.

:idea: usually there is another rule that the snake shall not touch itself. but i was too lazy to make it.

snake with food

snake with food

for the project i ordered a black joystick shield for $11.27 , as the soldering quality of the previous ‘white’ one was very bad. the nokia 5110 lcd i ordered from dx.com for $3.87 so it would directly match with the joystick shield. so makes $30 in total including the frdm-kl25z board.

startup screen for snake game

startup screen for snake game

ready to play snake game

ready to play snake game

the video shows the game in action:

the snake game runs as a freertos task. the drawing and graphics including fonts are implemented with processor expert components:

graphical display driver

graphical display driver

font and font driver

font and font driver

summary

so i have another nice usage for my boards and the joystick shields :-). i need to admit that i’m not very good at the game. my daughter reached level 4 in the first attempt, while my max level is 2, maybe it is just the age ;-). but i’m too honest *not* to build in a cheat mode, or should i? maybe ;-)

as always, the sources are available on github .

happy snaking :-)



Mobile phone Driver (software) Task (computing) Build (game engine) FreeRTOS GitHub mobile Arm (geography)

Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • How to Submit a Post to DZone
  • The Quest for REST
  • How To Create and Edit Excel XLSX Documents in Java
  • A Brief Overview of the Spring Cloud Framework

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: