And you should be greeted by Pimoroni’s colorful
“Deploy Rainbows” GIF.
5. PREPARE YOUR GIF SELECTION
The classic toy is restricted to a mere 20 answers,
but we, dear reader, live in the future! Our GIF-
Ball can for all intents and purposes house a
virtually endless array of images, answers, and,
most importantly, memes! So don't hold back
when it comes to selecting your reply set.
If you’re an 8-Ball purist, the original had 10
positive, 5 ambiguous, and 5 negative replies, so
a mere 20 GIFs will be sufficient to capture that
classic fortune-telling experience.
There are preselected GIFs in the download
package in the Images folder, but if you’re
selecting your own, try to find images with a
more square aspect ratio. The code will
accommodate different image sizes and naming
schemes, but keep in mind that while the mini IPS
display is crisp, its still only 240 pixels wide. Any
image that ends in .gif will be randomly selected
as a response.
6. SECURELY COPY YOUR FILES
Once you’ve curated your preferred selection of
GIFs, its time to slap ’em inside the Pi. Navigate
to the directory on your main computer where
you’ve got all your images, as well as the main
program (fortune.py), and transfer them to the Pi
via SCP (Secure Copy). For example:
scp fortune.py [email protected]:
Your GIFs and the program should now be in
/home/pi so you can now test it with:
python3 fortune.py
TIP: Learn more about using Secure Copy at
raspberrypi.org/documentation/remote-access/
ssh/scp.md.
We haven’t connected the tilt sensor yet, but
you can short BCM pin 2 to GND and the program
will register that as a “shake.
7. RUNNING THE PROGRAM AT BOOT
There are several options to have a program
autorun, but we'll keep it simple. Just call:
sudo nano /etc/rc.local
After the line exit 0, add:
sudo bash -c '/usr/bin/python3 /home/
pi/fortune.py’ &
8. SOLDERING
Cut a female jumper in half and solder the halves
to the leads of the vibration sensor (Figure
F
).
Solder a strip of 8 right-angle male headers to
the PowerBoost side connections, and a strip of 4
to the power pads (Figure
G
).
Solder the JST socket to the pushbutton
power switch (PPS) (red to IN, black to a GND
connection). Add 3" leads to the pushbutton and
solder to PPS pads 1 and 3. Cut and solder a red
F
65
make.co
G
M78_062-67_MagicGifBall_F1.indd 65M78_062-67_MagicGifBall_F1.indd 65 7/11/21 10:51 AM7/11/21 10:51 AM
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.30.253