diff --git a/micropython/examples/inky_frame/image_gallery/image_gallery.py b/micropython/examples/inky_frame/image_gallery/image_gallery.py index 0722bab9..50488283 100644 --- a/micropython/examples/inky_frame/image_gallery/image_gallery.py +++ b/micropython/examples/inky_frame/image_gallery/image_gallery.py @@ -1,12 +1,17 @@ # An offline image gallery that switches between five jpg images -# Copy them into your Pico's flash using Thonny. -# If you want to use your own images they must be 600 x 448 pixels or smaller -# and saved as *non-progressive* jpgs +# Copy them into the root of your Pico's flash using Thonny. -from pimoroni import ShiftRegister -from picographics import PicoGraphics, DISPLAY_INKY_FRAME +# If you want to use your own images they must be the screen dimensions (or smaller) +# and saved as *non-progressive* jpgs. + +# Make sure to uncomment the correct size for your display! + +from picographics import PicoGraphics, DISPLAY_INKY_FRAME as DISPLAY # 5.7" +# from picographics import PicoGraphics, DISPLAY_INKY_FRAME_4 as DISPLAY # 4.0" +# from picographics import PicoGraphics, DISPLAY_INKY_FRAME_7 as DISPLAY # 7.3" from machine import Pin import jpegdec +from pimoroni import ShiftRegister # you can change your file names here IMAGE_A = "jwst1.jpg" @@ -16,7 +21,7 @@ IMAGE_D = "jwst4.jpg" IMAGE_E = "jwst5.jpg" # set up the display -display = PicoGraphics(display=DISPLAY_INKY_FRAME) +graphics = PicoGraphics(DISPLAY) # Inky Frame uses a shift register to read the buttons SR_CLOCK = 8 @@ -42,14 +47,7 @@ hold_vsys_en_pin = Pin(HOLD_VSYS_EN_PIN, Pin.OUT) hold_vsys_en_pin.value(True) # Create a new JPEG decoder for our PicoGraphics -j = jpegdec.JPEG(display) - -# setup -activity_led.on() -# update the image on Inky every time it's powered up -# comment these lines out if running on battery power -# button_a_led.on() -# display_image(IMAGE_A) +j = jpegdec.JPEG(graphics) def display_image(filename): @@ -61,9 +59,16 @@ def display_image(filename): j.decode(0, 0, jpegdec.JPEG_SCALE_FULL) # Display the result - display.update() + graphics.update() +# setup +activity_led.on() +# update the image on Inky every time it's powered up +# comment these lines out if running on battery power +# button_a_led.on() +# display_image(IMAGE_A) + while True: button_a_led.off() button_b_led.off() diff --git a/micropython/examples/inky_frame/image_gallery/image_gallery_sd.py b/micropython/examples/inky_frame/image_gallery/image_gallery_sd.py index 89ac1f32..4610d908 100644 --- a/micropython/examples/inky_frame/image_gallery/image_gallery_sd.py +++ b/micropython/examples/inky_frame/image_gallery/image_gallery_sd.py @@ -1,15 +1,21 @@ # An offline image gallery that switches between five jpg images # on your SD card (copy them across by plugging your SD into a computer). -# If you want to use your own images they must be 600 x 448 pixels or smaller + +# If you want to use your own images they must be the screen dimensions (or smaller) # and saved as *non-progressive* jpgs +# Make sure to uncomment the correct size for your display! + +from picographics import PicoGraphics, DISPLAY_INKY_FRAME as DISPLAY # 5.7" +# from picographics import PicoGraphics, DISPLAY_INKY_FRAME_4 as DISPLAY # 4.0" +# from picographics import PicoGraphics, DISPLAY_INKY_FRAME_7 as DISPLAY # 7.3" from pimoroni import ShiftRegister -from picographics import PicoGraphics, DISPLAY_INKY_FRAME from machine import Pin, SPI import jpegdec import sdcard import uos + # you can change your file names here IMAGE_A = "sd/jwst1.jpg" IMAGE_B = "sd/jwst2.jpg" @@ -18,7 +24,7 @@ IMAGE_D = "sd/jwst4.jpg" IMAGE_E = "sd/jwst5.jpg" # set up the display -display = PicoGraphics(display=DISPLAY_INKY_FRAME) +graphics = PicoGraphics(DISPLAY) # Inky Frame uses a shift register to read the buttons SR_CLOCK = 8 @@ -49,14 +55,7 @@ hold_vsys_en_pin = Pin(HOLD_VSYS_EN_PIN, Pin.OUT) hold_vsys_en_pin.value(True) # Create a new JPEG decoder for our PicoGraphics -j = jpegdec.JPEG(display) - -# setup -activity_led.on() -# update the image on Inky every time it's powered up -# comment these lines out if running on battery power -# button_a_led.on() -# display_image(IMAGE_A) +j = jpegdec.JPEG(graphics) def display_image(filename): @@ -68,9 +67,16 @@ def display_image(filename): j.decode(0, 0, jpegdec.JPEG_SCALE_FULL) # Display the result - display.update() + graphics.update() +# setup +activity_led.on() +# update the image on Inky every time it's powered up +# comment these lines out if running on battery power +# button_a_led.on() +# display_image(IMAGE_A) + while True: button_a_led.off() button_b_led.off()