import time
import sys
import logging
from Adafruit_SSD1306 import SSD1306_128_64
from PIL import Image, ImageDraw, ImageFont
from time import sleep

display.clear()
    display.display()

    try:
        # Load the bitmap image (ensure the path is correct)
        bitmap_image = Image.open("intro_screen.bmp").convert("1")  # Convert to 1-bit color
        # Check the size of the image
        if bitmap_image.size != (128, 64):
            bitmap_image = bitmap_image.resize((128, 64))  # Resize if not the correct size

        # Paste the bitmap image onto the OLED display buffer
        image.paste(bitmap_image, (0, 0))
        
        # Display the bitmap on the OLED
        display.image(image)
        display.display()

        # Pause to show the intro screen
        sleep(5)

    except Exception as e:
        print(f"Error displaying bitmap image: {e}")
        # Fallback to text if the image fails to load
        draw.rectangle((0, 0, width, height), outline=0, fill=0)
        draw.text((20, 20), "Intro Screen", font=font, fill=255)
        display.image(image)
        display.display()
        sleep(5)
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT
pico:GP0
pico:GP1
pico:GND.1
pico:GP2
pico:GP3
pico:GP4
pico:GP5
pico:GND.2
pico:GP6
pico:GP7
pico:GP8
pico:GP9
pico:GND.3
pico:GP10
pico:GP11
pico:GP12
pico:GP13
pico:GND.4
pico:GP14
pico:GP15
pico:GP16
pico:GP17
pico:GND.5
pico:GP18
pico:GP19
pico:GP20
pico:GP21
pico:GND.6
pico:GP22
pico:RUN
pico:GP26
pico:GP27
pico:GND.7
pico:GP28
pico:ADC_VREF
pico:3V3
pico:3V3_EN
pico:GND.8
pico:VSYS
pico:VBUS
oled1:GND
oled1:VCC
oled1:SCL
oled1:SDA