Escape rooms are all about timing: You’re allotted a specific amount of time (typically, an hour) to solve the
puzzles and escape. Most escape room
businesses use a computer for overall
game timing, but what if we want to
create something small and stand-alone;
something we could play at a party?
Over the past few issues, we have
explored all the elements to create such
a prop. So, this time, we’ll knit them together to create a
timed game piece that can be reconfigured from its own
interface.
The Display’s the Thing
I’m using the same circuit from the July column, with
the addition of another display module from Adafruit. The
great thing about I2C is pin sharing; we can connect the
second display right to the first (Figure 1). The second
display has four seven-segment digits and includes a colon
in the middle which makes it perfect for displaying time.
Yes, we can display time on the 14-segment display,
but it’s not ideal without the colon. Humans are very
visual and prefer little clues like a
colon which is used when
formatting standard time.
Before we get to the displays,
let’s get to the heart of them.
Both displays use the Holtek
HT16K33. This chip will control
up to eight digits with up to 16
segments each.
It also has the ability to scan
keys, but that feature is not made
available in the Adafruit displays,
so we’ll skip it.
The interface is through I2C
and is darn easy. The start()
method for the base object
allows us to specify the I2C pins and the device address
(%000...%111). The device address is combined with the
HT16K33 slave ID (%1110_000_0) so that we target the
correct display when more than one is on the same buss.
If we run an I2C buss scanner (included in article
downloads), we’ll see the independent addresses of the
displays (Figure 2).
There’s only a few control registers that we have to be
concerned with; most of our work will be writing segment
data to the display. On power-up, the HT16K33 oscillator
is stopped and the display is blank. The system setup
register ($2x) uses BIT0 to enable the oscillator. If we write
$21 to the display, the oscillator will start running. The
display control register ($8x) allows us to set the display
on or off, as well as control the
blinking. Blinking uses two bits
which gives us none, 2 Hz, 1 Hz,
or 0.5 Hz blink rates. The object
keeps a copy of this byte so that
one element can be changed
without losing the other. We can
choose between the
set_display(), display_on(), and
set_blink() methods to affect the
display control register:
Game Time
I'm writing from the road again. This trip has me in my old stomping grounds of the
Dallas-Fort Worth Metroplex. After driving a colleague to the airport, I popped into one of
my favorite places in the area: Tanner Electronics. I'll need parts while I'm here, and it's
great to have a source run by such lovely people. After that stop, I continued up I35 to
Lewisville where I visited my friends at Escape Rooms HQ. They've only been open a few
months and are booked solid — so much so that they're opening a second location.
ERHQ uses Propellers (coded by yours truly) in several props and puzzles, so I'm very
happy that things are going well. Their timing for creating a well-executed escape room
seems to have been spot on.
■ BY JON MCPHALEN THE SPIN ZONE
ADVENTURES IN PROPELLER PROGRAMMING
■ FIGURE 2. I2C
buss scan.
■ FIGURE 1.
Display
connections.
Jon "JonnyMac" McPhalen
jon@jonmcphalen.com
Parallax, Inc.
www.parallax.com
September 2016 57