You can customize the messages and the colors if you want. All the lines of code to do this are at the top.

Changing Messages

The messages are stored as a tuple of tuples. Yah, that sounds weird, but tuples can contain anything, including other tuples. It's these lines of code at the top:

    ("I LUV", "YOU"),
    ("SAY", "YES"),
    ("HUG", "ME"),
    ("BE", "MINE"),

Each message is a tuple with two text strings - one for each line. You need to specify both, even if you only want one line. See the PEACE message as an example of a single line message. Its second line is blank. You can remove or add more messages as you wish or edit the ones that are there.

NOTE: Line 1 can have up to 9 characters. Line 2 can have up to 5 characters.

Be careful not to forget the trailing comma at the end of each line in the tuple. It is OK if the last line has one as well.

Changing Colors

You can also change the heart and message text colors if you want. These are also defined as tuples, but this time just a straight simple tuple of color values. It's these lines of code at the top:

    0xEAFF50, # yellow
    0xFFAD50, # orange
    0x9D50FF, # purple
    0x13B0FE, # blue
    0xABFF96, # green
    0xFF96FF, # pink
    0xFF0000, # red

There's a separate tuple for the heart colors, HEART_COLORS, and one for the message colors, MESSAGE_COLORS. Just add/remove entries as you wish. We kept MESSAGE_COLORS to a single value in the default code just because it seemed to look the best. But you can add more if you want.

Changing Interaction

The default code changes messages whenever either of the buttons on the Circuit Playground are pressed. That's done with these lines of code:

# wait for button press
while not cp.button_a and not cp.button_b:
# just a little debounce

You could change that to something else if you want. You would replace those lines with something else. Some ideas are tap:

# wait for tap
while not cp.tapped:


# wait for shake
while not cp.shake():

or a simple timer:

# change every 5 seconds

But you could also maybe do sound? Or temperature?

This guide was first published on Feb 09, 2020. It was last updated on Jun 17, 2024.

This page (Customizing) was last updated on Mar 08, 2024.

Text editor powered by tinymce.