Figured out word wrapping on the Piicodev OLED module

Not sure if this will work on the Pi Pico, but I thought I’d share anyway.

IMG_0934

from PiicoDev_SSD1306 import *
import textwrap

display = create_PiicoDev_SSD1306()

def display_text(text):
        this_text = textwrap.wrap(text, width=15)
        for i in range(0, len(this_text)):
                display.text(this_text[i], 0, (i * 15), 1)
        display.show()

display_text('Hello, this is some text. Can you see it is word wrapped?')
6 Likes

Nice Steven! With some scrolling it could definitely give off some Matrix vibes :smiley:

2 Likes

Thank you for sharing. Can the same task be performed with a standard Raspberry pi? Like 4 or earlier versions?

I’m using a raspberry Pi 4B.

I see. Thank you.

This is great! We’ll look at building it in - I’m unsure about compatibility across different devices, but it’s too good to ignore if available.
Nice work @Steven :smiley:

2 Likes

Just checked, we’re in luck! Code exists for micropython.

2 Likes