If anyone is interested I found the answer...
Code: Select all
'''
Continuous vertical scroll
If you want to scroll the screen in and out vertically continuously, you
can use the scroll_in_out_screen_v(screen) function.
'''
import machine
from machine import I2C
from sh1106 import SH1106_I2C
# ------------------------------------------------------------------------
# Define GPIO pins
i2c = I2C(0, sda=machine.Pin(4), scl=machine.Pin(5), freq=400000)
# ------------------------------------------------------------------------
oled_width = 128
oled_height = 64
oled = SH1106_I2C(oled_width, oled_height, i2c)
# ----------------------
screen1_row1 = "Screen 1, row 1"
screen1_row2 = "Screen 1, row 2"
screen1_row3 = "Screen 1, row 3"
# ----------------------
screen2_row1 = "Screen 2, row 1"
screen2_row2 = "Screen 2, row 2"
# ----------------------
screen1 = [[0, 0 , screen1_row1], [0, 16, screen1_row2], [0, 32, screen1_row3]]
screen2 = [[0, 0 , screen2_row1], [0, 16, screen2_row2]]
# ------------------------------------------------------------------------
#Define Functions
def scroll_screen_in_out_v(screen):
for i in range (0, (oled_height*2+1), 1):
for line in screen:
oled.text(line[2], line[0], -oled_height+i+line[1])
oled.show()
if i!= oled_height:
oled.fill(0)
# ------------------------------------------------------------------------
while True:
# Continuous verticall scroll
scroll_screen_in_out_v(screen1)
scroll_screen_in_out_v(screen2)