CLUE Slideshow

The Adafruit CLUE comes with built in buttons and a display. Using CircuitPython, the Adafruit CircuitPython CLUE and Adafruit CircuitPython Slideshow libraries, and the built in buttons and display, we can easily make an interactive slideshow.

Blinka Bitmaps

First, you'll need to load some compatible bitmap files onto your CIRCUITPY drive. We've included three compatible bitmaps below to get you started. For information on how to create your own compatible bitmaps, check out the Customization section of the Notifcation Icons page in this guide.

CircuitPython Libraries

Remember that you must have the necessary libraries installed. Verify that your lib folder matches the list found on the CLUE CircuitPython Libraries page before continuing.

CLUE Slideshow Example

Once the code and bitmaps are loaded, try pressing button B to move forward through displaying the images, and button A to move backward through displaying the images!

"""Display a series of bitmaps using the buttons to advance through the list. To use: place
supported bitmap files on your CIRCUITPY drive, then press the buttons on your CLUE to advance
through them.

Requires the Adafruit CircuitPython Slideshow library!"""

from adafruit_clue import clue
from adafruit_slideshow import SlideShow, PlayBackDirection

slideshow = SlideShow(clue.display, auto_advance=False)

while True:
    if clue.button_b:
        slideshow.direction = PlayBackDirection.FORWARD
        slideshow.advance()
    if clue.button_a:
        slideshow.direction = PlayBackDirection.BACKWARD
        slideshow.advance()

Let's take a look at the code.

First we import the CLUE library and the parts of the Slideshow library we intend to use: SlideShow and PlayBackDirection.

Then we create the slideshow. To create the slideshow, you must provide it the display object (clue.display). For this example, we've also set auto_advance=False. We don't want it to auto advance because we'll be using the buttons to advance through the images.

Inside the loop, we check for when each button is pressed. When button B is pressed, we set the playback direction to FORWARD and advance one image. When button A is pressed, we set the playback direction to BACKWARD, and advance one image.

That's all there is to creating a slideshow on your Adafruit CLUE using CircuitPython!

This guide was first published on Feb 08, 2020. It was last updated on 2020-07-11 12:23:14 -0400.
This page (CLUE Slideshow) was last updated on Jul 13, 2020.