This is the sort of thing I've done a few times: ElitePetite, LittleZone, Rasteroids etc.
This was all about fast rendering, so it's close to the metal. I access the LCD directly via registers, so the code is specific to the Uno and the type(s) of LCD I have access to. Jaycar has sold at least three XC4630 variations, it should work with any of them by setting the appropriate #define. The code determines the pixels to send to the screen, on-the-fly. There is no buffering, even the clipping is on-the-fly.
Extensive use is made of PROGMEM lookups. The ball is a a pair of PROGMEM data structures, created as a header file by a Python script in the resources subdir (ball_encode.py). This run-length-encodes an image made by another script (ball_render.py). The image script makes a .PNG of the faceted ball, with 8x as many faces on a layer, facets are given one of N colours, Rendering the ball is a matter of scanning rows in the data, accumulating runs of a physical colour (red or white) from runs of logical colours, then sending to the LCD. Only the background pixels exposed by the ball's movement are redrawn.
The background grid is also encoded as PROGMEM data, created by grid_encode.py. This provides faster repainting. The intent to send a block of colour to the LCD from the ball, or the background rendering logic, passes through additional logic which clips it with respect to the clock window, if present.
As a raison d’etre for having the thing as a desk accessory, it can optionally show the time. I’ve added 3 "windows":
- An "analog" clock, based on the Amiga one, but small.
- A "digital" clock, not sure this existed but it is conveniently small.
- A "workbench" clock. This shows the time digitally on the workbench title bar.
Video demonstrating the various clock windows, moving, hiding/showing & the menu.:
I made a simple laser-cut "monitor" enclosure using my Inksnek Python library.
It and other resources are in the resources sub-directory in the repo.
There is quite a bit more detail about the code and features in AMeagreBall.ino.
Physically this is just a Uno mated with an LCD shield. The only interesting bit is the RTC squeezed between them on the ICSP pins (because the other pins are blocked by the shield). See i-c-s-p-r-t-c
More pictures on Flickr
Mark Wilson
Bob Anderson
Shravana H S
Craig Hissett
Very nice clock. I love Amiga time. You must be excellent programmer.