Skip to content

Suggestion: Pico OLED 1.3 rotation example #11

@maverickagm

Description

@maverickagm

The demo code doesn't handle 90 degree rotation. It's not trivial to rotate the display, but it's definitely possible. The display on the Pico OLED 1.3" is an SH1107. Perhaps the Pico OLED 1.3" display driver should be rebased off of https://github.com/peter-l5/SH1107

I used Thonny to copy over sh1107.py. Then I used the following to initialize the display (SPI mode) and rotate it 90 degrees clockwise:

import sys, time
from machine import Pin,SPI
import sh1107

# Pin numbers for Waveshare Pico OLED 1.3"
DC = 8
RST = 12
MOSI = 11
SCK = 10
CS = 9

# init screen
ROTATE = 90 # for 90 degree clockwise rotation
spi1 = SPI(1,20000_000, polarity=0, phase=0, sck=Pin(SCK), mosi=Pin(MOSI), miso=None)
display = sh1107.SH1107_SPI(128, 64, spi1, Pin(DC), Pin(RST), Pin(CS), rotate=ROTATE)

display.fill(0)
display.text("Hello",0, 2,1)
display.text("World",0,10,1)
display.show()
time.sleep(1)
sys.exit(0)

Minor note: The example code downloaded from https://files.waveshare.com/upload/5/5a/Pico_code.7z is newer than what's in this repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions