body, html {font-family: 'Open Sans', sans-serif;} #nav a, #nav span.in{font-family: 'Open Sans', sans-serif;} #title #tagline {font-family: 'Open Sans', sans-serif;} #main .gridItem h3 {font-family: 'Open Sans', sans-serif;}

23rd JC: Snake Cache


Schnappschuss (2018-10-01 06.58.06)


A new challenge for me: Building a SMART cache based on the game SNAKE!. Up to now I only used the touch functionality of a TFT display to determine, if it was touched or not. Now I wanted to go on and determine where it was touched to built something like menus. And I wanted no longer to use TFTs from China but „high quality“ from Adafruit. This is the one, I’ve finally chosen. 

It took some time up to I’ve discovered, why some sketches - wirtten by Adafruit - worked pretty well while other didn’t. This TFT is offered as shield and breakout. The hardware isn’t the same and also the wiring and - last not least - the sketches are different as well. 

Another topic became quite hard as well. At the beginning I wanted to write the sketch 100% by my own. So I started to move a snake around the TFT and discovered that that was much mor difficult as I’ve expected. To avoid having the sketch ready just before my 70th birthday, I decided to use an already existing one. The sketch written by Arnau/Redrednose/mas886 was looking pretty fine. But it took some time, up I was able to take the first video of my prototype:

  • As already written, I need to understand the difference between my breakout and the shield mas886 used. Based on that I had to rewrite all parts dealing with the touch functionality.
  • I’ve added my „Better_Timer()“ subroutine to generate much better random figures when the game is powered on. A lot of people are reading the value of an unused analog pin for randomSeed(). But there’s a very high chance, the random figures will be like the ones after the last power on. My subroutine is storing a value inside EEPROM, which will be used after the next power on.
  • I’ve added at the beginning a menu to choose between English and German language (not shown in the video below)
  • And finally I wanted to have the picture of a snake as background. In really I used the same picture in two versions: One is a real picture and the other one (66% covered by a grey layer) is used as background.

As ever: By clicking on the YouTube button, you can watch in 1080p quality…


On Sunday all parts were printed on my 3D printer and I’ve mounted the whole stuff into an ammo can. 


The sketch will be soon available for download here...




©  Olaf Goette 2008 - 2018