Use It

The basic code will present a new picture each 60 seconds.

The image below has been set for 3 seconds between pictures to better show a selection of images. 

Customization of the Slideshow

The adafruit_slideshow library function has several parameters that can be changed. The latest documentation for parameters is on ReadTheDocs.

Let's look at the code again:

# CircuitPython Slideshow - uses the adafruit_slideshow.mpy library
import board
from adafruit_slideshow import PlayBackOrder, SlideShow

# Create the slideshow object that plays through once alphabetically.
slideshow = SlideShow(board.DISPLAY,
                      folder="/images",
                      loop=True,
                      order=PlayBackOrder.ALPHABETICAL,
                      dwell=60)

while slideshow.update():
    pass

board.DISPLAY is common to all boards and is required. If there is an error, it probably is that your board does not have a predefined display. If you are an advanced user and hook your own display up, this will need to be defined.

folder = "/images" sets the image folder to the CIRCUITPY /images directory that we used. You can specify other directories.

loop = True has the images looping back to the starting image when the last image completes displaying.

order = PlayBackOrder.ALPHABETICAL plays the images in alphabetical order - the only other option is order=PlayBackOrder.RANDOM

dwell= 60 is a parameter you may want to change. This is the amount of time a picture is on the screen in seconds. I think a minute (60 second) is a bit long, perhaps you want 30 seconds for a fast display or 3600 seconds for an hour.

For all the available parameters:

classadafruit_slideshow.SlideShow(displaybacklight_pwm=None*folder='/'order=0loop=True,
dwell=3fade_effect=Trueauto_advance=Truedirection=1)

Parameters:

  • folder (str) – Specify the folder containing the image files, in quotes. Default is the root directory, "/".
  • order (PlayBackOrder) – The order in which the images display. You can choose random (RANDOM) or alphabetical (ALPHABETICAL). Default is ALPHABETICAL.
  • loop (bool) – Specify whether to loop the images or play through the list once. True if slideshow will continue to loop, False if it will play only once. Default is True.
  • dwell (int) – The number of seconds each image displays, in seconds. Default is 3.
  • fade_effect (bool) – Specify whether to include the fade effect between images. True tells the code to fade the backlight up and down between image display transitions. False maintains max brightness on the backlight between image transitions. Default is True.
  • auto_advance (bool) – Specify whether to automatically advance after dwell seconds. True if slideshow should auto play, False if you want to control advancement manually. Default is True.
  • direction (PlayBackDirection) – The playback direction. 1 = forward, -1 backward.
This guide was first published on Aug 12, 2019. It was last updated on Aug 12, 2019. This page (Use It) was last updated on Oct 04, 2019.