Create an I2C OLED Show Slideshow with Python
von Satoshi Nakamoto

As soon as I bought my miniature OLED show engaged on the Raspberry Pi I made a decision to create a Python script to generate a picture slideshow. The script I got here up with reads photos from a listing which it then resizes and converts earlier than displaying on the display screen.

0.9 Inch OLED Show
As a way to use the slideshow script you must have the OLED display screen linked to your Pi through the I2C interface and test it's working utilizing the Adafruit instance scripts.
Full particulars of the show setup could be present in my Utilizing an I2C OLED Show Module with the Raspberry Pi.
Obtain Slideshow Python Script
Guarantee you're within the residence listing :
cd ~
Create a listing to retailer the script and pictures :
mkdir slideshow
and navigate to this new listing :
cd slideshow
Now the slideshow script could be downloaded from my BitBucket repository on to your Pi utilizing :
wget https://bitbucket.org/MattHawkinsUK/rpispy-misc/uncooked/grasp/oled/oled_slideshow.py
Let’s simplify the script title and rename it utilizing :
mv oled_slideshow.py slideshow.py
Populate Listing with Pictures
You will discover your individual photos however to get you began you may obtain these instance photos to your Pi :
wget https://bitbucket.org/MattHawkinsUK/rpispy-misc/uncooked/grasp/oled/terminator.pbm
wget https://bitbucket.org/MattHawkinsUK/rpispy-misc/uncooked/grasp/oled/robocop.pbm
wget https://bitbucket.org/MattHawkinsUK/rpispy-misc/uncooked/grasp/oled/cyberman.pbm
Use the next command to checklist the recordsdata within the slideshow listing and test the pictures are in the identical place because the slideshow script :
ls -l
It's best to see the next recordsdata listed :
slideshow.py
terminator.pbm
robocop.pbm
cyberman.pbm
Run the Instance Script
The script could be run utilizing Python 2 or Python 3.
Operating underneath Python Three is finished utilizing :
python3 slideshow.py
You possibly can change the delay between every picture by specifying the delay on the command line as an integer :
python3 slideshow.py 4
Improve I2C Bus Pace
That is non-obligatory however to enhance the refresh fee of the display screen you may enhance the bus pace of the I2C interface. This may be finished by following the Change Raspberry Pi I2C Bus Pace tutorial.
The Slideshow in Motion
The slideshow ought to look one thing like this :
Picture Decision Suggestions
The script appears on the picture decision and resizes it if it doesn't match the show measurement.
Resizing photos takes longer so with smaller delays the elevated processing time could also be seen. That is very true if the pictures are all totally different sizes and can take barely totally different quantities of time to course of. Because of this it's possible you'll want to resize all of your photos to a standard measurement earlier than they're positioned within the listing with the script.
There are many modifications that may be made to this script. Maybe the pictures could possibly be created routinely by the Pi digicam and the slideshow script would then show them on the display screen?
Troubleshooting
Lastly if you're having issues listed below are some issues to contemplate :
Did you efficiently setup the display screen and get the Adafruit examples working?
Did you obtain the oled_slideshow.py script to the identical listing as your photos?
Attempt working the script with only some photos
Source link
Read the full article
Satoshi Nakamoto
Keine Verbindung
Verbindung wird wiederhergestellt
Etwas ist schiefgelaufen
Wir sind gleich wieder da