User manual

5) VERTICAL BAR GRAPHS
You can create vertical bar graphs in exactly the same way we did the horizontal ones:
- Create a series of vertical bar symbols
- Write routines for drawing the bar, breaking it down into full characters with a final,
partially filled character
- Write an animation routine, calling on IncrementVBar and DecrementVBar
See the script listing at the end for all of the details. The code is almost exactly the same.
6) BIG CLOCK
I really enjoyed working with the Pi Matrix, because the display is fun to watch. Who
doesn’t like blinky LEDs? LCDs have to work harder to get the same WOW factor. I was
wondering what to do for this board, when I came across some images for the “LCD
smartie” clock plugin, shown here.
Now that looks like 20x4 LCD fun. But how
do you program it?
Stare at the image for a while, and you’ll see
that each digit is rendered in a 3x4 block of
characters. And each character is made up of
just a few symbols: a solid block, some
triangles, and some half-height blocks.
We already know how to make the custom characters. You can emulate the smartie digits
with 7 different symbols: lower-right triangle, lower-left triangle, upper-right triangle, upper-
left triangle, upper horizontal bar, lower horizontal bar, and solid block. Here they are:
digits = [
[ 0x01, 0x03, 0x03, 0x07, 0x07, 0x0F, 0x0F, 0x1F ], #lower-rt triangle
[ 0x10, 0x18, 0x18, 0x1C, 0x1C, 0x1E, 0x1E, 0x1F ], #lower-lf triangle
[ 0x1F, 0x0F, 0x0F, 0x07, 0x07, 0x03, 0x03, 0x01 ], #upper-rt triangle
[ 0x1F, 0x1E, 0x1E, 0x1C, 0x1C, 0x18, 0x18, 0x10 ], #upper-lf triangle
[ 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F ], #lower horiz bar
[ 0x1F, 0x1F, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x00 ], #upper horiz bar
[ 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F ] #solid block
]
Each digit is made up of a 3x4 grid of these symbols. I created a list with 10 members for
the 10 digits. Each member is a list of the 12 symbols needed to create the digit.
bigDigit = [
[ 0x00, 0x06, 0x01, 0x06, 0x20, 0x06, 0x06, 0x20, 0x06, 0x02, 0x06, 0x03], #0
[ 0x20, 0x06, 0x20, 0x20, 0x06, 0x20, 0x20, 0x06, 0x20, 0x20, 0x06, 0x20], #1
[ 0x00, 0x06, 0x01, 0x20, 0x00, 0x03, 0x00, 0x03, 0x20, 0x06, 0x06, 0x06], #2
[ 0x00, 0x06, 0x01, 0x20, 0x20, 0x06, 0x20, 0x05, 0x06, 0x02, 0x06, 0x03], #3
[ 0x06, 0x20, 0x06, 0x06, 0x06, 0x06, 0x20, 0x20, 0x06, 0x20, 0x20, 0x06], #4
[ 0x06, 0x06, 0x06, 0x06, 0x04, 0x04, 0x20, 0x20, 0x06, 0x06, 0x06, 0x03], #5
[ 0x00, 0x06, 0x01, 0x06, 0x20, 0x20, 0x06, 0x05, 0x01, 0x02, 0x06, 0x03], #6
[ 0x06, 0x06, 0x06, 0x20, 0x20, 0x06, 0x20, 0x20, 0x06, 0x20, 0x20, 0x06], #7