Custom character on PiFace Control And Display

Difficulty: medium

Have a great idea for a project, but need your own custom character? Learn how to create cool custom bitmaps with PiFace Control And Display

Writing Custom Characters to PiFace Control

If you have run our example programs, you may have noticed that you can display custom images on the PiFace CAD LCD display, here’s how!

Create a Python file in your favourite text editor and copy the following code
import pifacecad
cad = pifacecad.PiFaceCAD()
smileyBM = pifacecad.LCDBitmap([
0b00000,
0b01010,
0b00000,
0b00100,
0b00000,
0b01010,
0b01110,
0b00000])
cad.lcd.store_custom_bitmap(0,smileyBM)
cad.lcd.write_custom_bitmap(0)

In this code we created a bitmap, stored it to the LCD's memory and then displayed it. This will draw a smiley face to the PiFace CAD screen. Change the binary values (e.g. 0b01110) to create a different pattern.

Save the file and run it with the version of python you have installed PiFace CAD for
e.g. python3 yourFile.py

You can create many different bitmaps and store and write up to 8 of these at a time. When you stored the bitmap you gave it the number 0, this is the index number that is used in the write custom bitmap function. Your bitmaps should be stored under the indexes of 0-7.

If you store a new bitmap under an index number where a bitmap was already stored and written to the screen, the character on the screen will update to this new bitmap.