ssd1306 display scroll

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
User avatar
timotet
Posts: 6
Joined: Sun Dec 14, 2014 12:01 am
Location: Bend, Or.
Contact:

Re: ssd1306 display scroll

Post by timotet » Fri Jun 15, 2018 7:26 pm

@bergpb
Please post a examples how to use horizontal scroll.
I haven't worked on this in awhile, it worked great for me.
Good luck.

Code: Select all

# example for ssd1306 with module from here https://github.com/timotet/SSD1306
# runs under micropython version 1.8.7

# import machine
from machine import Pin, I2C
import time
import ssd1306


def lcdInit():
    # I2C pins
    # I have 4k7 pull ups on scl and sda
    # set up I2C on gpio 14 and 16
    i2c = I2C(scl=Pin(16), sda=Pin(14), freq=100000)
    lcd = ssd1306.SSD1306_I2C(128, 32, i2c)            # lcd is 128x32
    return lcd


def main():

    display = lcdInit()
    display.clear()

    while True:

        display.text("Hello World", 0, 0)
        # scroll right
        display.hw_scroll_h()

        time.sleep(3)

        # scroll left
        display.hw_scroll_h(False)

        time.sleep(3)

        display.hw_scroll_off()
        time.sleep(3)
        display.clear()
        time.sleep(1)

Post Reply