I want to get 2 images to swap back and forth on my Stellar Unicorn. I have a jpg image already showing on the unicorn but want it to show another image quickly. Is there code I can use to make it that after 0.5 seconds the image changes, I’m very new to all this! Thank you :)
Could you post the code you have so far please?
from picographics import PicoGraphics, DISPLAY_STELLAR_UNICORN as DISPLAY
from stellar import StellarUnicorn
import jpegdec
stellar = StellarUnicorn()
graphics = PicoGraphics(DISPLAY)
# Create a new JPEG decoder for our PicoGraphics
j = jpegdec.JPEG(graphics)
# Open the JPEG file
j.open_file("pee.jpg")
# Decode the JPEG
j.decode(0, 0, jpegdec.JPEG_SCALE_FULL)
# Display the result
stellar.update(graphics)
Something like this may work? Worth a try anyway, I just quickly did it up.
import jpegdec
import time
stellar = StellarUnicorn()
graphics = PicoGraphics(DISPLAY)
# Create a new JPEG decoder for our PicoGraphics
j = jpegdec.JPEG(graphics)
while True:
# Open the JPEG file
j.open_file("pee.jpg")
# Decode the JPEG
j.decode(0, 0, jpegdec.JPEG_SCALE_FULL)
# Display the result
stellar.update(graphics)
time.sleep(0.5)
# Open the JPEG file
j.open_file("other.jpg")
# Decode the JPEG
j.decode(0, 0, jpegdec.JPEG_SCALE_FULL)
# Display the result
stellar.update(graphics)
time.sleep(0.5)
1 Like
Thank you I’ll give that a go now and see if I can get that working :)
Thank you that works perfectly, I’ll post a quick video in a bit :D
1 Like