Page 1 of 2

ssd1306 display scroll

Posted: Wed Aug 31, 2016 2:18 am
by diegoalt5
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

Re: ssd1306 display scroll

Posted: Wed Aug 31, 2016 6:57 am
by deshipu
At the moment it only works when one of the arguments is 0.

Re: ssd1306 display scroll

Posted: Wed Aug 31, 2016 10:34 am
by mcauser
It discards bits moved offscreen? or wraps?

Re: ssd1306 display scroll

Posted: Wed Aug 31, 2016 12:24 pm
by deshipu

Re: ssd1306 display scroll

Posted: Wed Aug 31, 2016 12:26 pm
by deshipu
By the way, that display has hardware scrolling capability, it would probably be better to use that.

Re: ssd1306 display scroll

Posted: Wed Aug 31, 2016 4:17 pm
by diegoalt5
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

Re: ssd1306 display scroll

Posted: Tue Mar 14, 2017 11:21 pm
by idimitrakopoulos
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

Re: ssd1306 display scroll

Posted: Wed Mar 15, 2017 12:58 am
by mcauser
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.

Re: ssd1306 display scroll

Posted: Wed Mar 15, 2017 4:25 am
by timotet
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

Re: ssd1306 display scroll

Posted: Fri Jun 15, 2018 2:40 pm
by bergpb
Please post a examples how to use horizontal scroll.
Awesome work. :D :D