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.
diegoalt5
Posts: 2
Joined: Wed Jun 29, 2016 1:33 am

ssd1306 display scroll

Post by diegoalt5 » Wed Aug 31, 2016 2:18 am

Hi, i am looking the ssd1306 display library and I see that it has a method called scroll, I thought that this method scrolls all the pixels in my display but it doesn't work.

My code:

import ssd1306
from machine import I2C, Pin
import math
i2c = I2C(sda=Pin(4), scl=Pin(5))
display = ssd1306.SSD1306_I2C(64, 48, i2c, 60)
display.fill(0)
display.text("Hello",0,0,1)
display.show()

After that i try to scroll using

display.scroll(5,5)
display.show()

But it doesn't work.

Do you know how scroll works?

Thanks

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: ssd1306 display scroll

Post by deshipu » Wed Aug 31, 2016 6:57 am

At the moment it only works when one of the arguments is 0.

User avatar
mcauser
Posts: 507
Joined: Mon Jun 15, 2015 8:03 am

Re: ssd1306 display scroll

Post by mcauser » Wed Aug 31, 2016 10:34 am

It discards bits moved offscreen? or wraps?


User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: ssd1306 display scroll

Post by deshipu » Wed Aug 31, 2016 12:26 pm

By the way, that display has hardware scrolling capability, it would probably be better to use that.

diegoalt5
Posts: 2
Joined: Wed Jun 29, 2016 1:33 am

Re: ssd1306 display scroll

Post by diegoalt5 » Wed Aug 31, 2016 4:17 pm

Hi, Thanks for your answer, it works but only in Y scroll
means that this works:
display.scroll(0,10)
display.show()

but this not
display.scroll(10,0)
display.show()

deshipu: you said that the display has hardware scrolling capability, how it works? how can i achieve it?

Thank you guys

idimitrakopoulos
Posts: 4
Joined: Thu Oct 20, 2016 7:15 pm

Re: ssd1306 display scroll

Post by idimitrakopoulos » Tue Mar 14, 2017 11:21 pm

Hello,

I made a quick scroll-down function, not the smoothest scroll but for an ESP its good.

Here's the function

Code: Select all

import time

def scroll_down_show(oled, line_to_show):

    for y in range(0, -6, -1):
        time.sleep(0.01)
        oled.scroll(0, y)

        if y == -5:
            oled.text(line_to_show, 0, 15)
        oled.show()
        
Here's how to use it (assuming that your SSD1306 screen is a variable called 'oled')

Code: Select all

for n in range(0,500):
    scroll_down_show(oled, str(n))
Hopefully it helps someone.... I will also integrate it in illuminOS

User avatar
mcauser
Posts: 507
Joined: Mon Jun 15, 2015 8:03 am

Re: ssd1306 display scroll

Post by mcauser » Wed Mar 15, 2017 12:58 am

How does the hardware scrolling work?
Here's how it works in an Arduino example:
https://github.com/adafruit/Adafruit_SS ... 6.cpp#L330

The hardware display buffer is 128x64, so if you are using the SSD1306 with a smaller OLED, such as the wemos 64x48 OLED, scrolling reveals parts of the buffer that were not being displayed, so you would need to scroll the software buffer instead and send it across.

User avatar
timotet
Posts: 6
Joined: Sun Dec 14, 2014 12:01 am
Location: Bend, Or.
Contact:

Re: ssd1306 display scroll

Post by timotet » Wed Mar 15, 2017 4:25 am

I modified the micropython SSD1306 library and added hardware scroll.
It seems to work great for me. Try it out.

https://github.com/timotet/SSD1306

bergpb
Posts: 16
Joined: Sun Jun 10, 2018 2:51 pm

Re: ssd1306 display scroll

Post by bergpb » Fri Jun 15, 2018 2:40 pm

Please post a examples how to use horizontal scroll.
Awesome work. :D :D
Last edited by bergpb on Fri May 08, 2020 8:11 pm, edited 1 time in total.

Post Reply