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:
# SPDX-FileCopyrightText: 2019 Anne Barela for Adafruit Industries # # SPDX-License-Identifier: MIT # 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
(display, backlight_pwm=None, *, folder='/', order=0, loop=True,
dwell=3, fade_effect=True, auto_advance=True, direction=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 isALPHABETICAL
. -
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 isTrue
. - 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 isTrue
. -
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 isTrue
. - direction (PlayBackDirection) – The playback direction. 1 = forward, -1 backward.
Text editor powered by tinymce.