Hello, how can I scroll a text from left to right on the SSD1306 display. In MicroPython on an ESP32?
Yes.
See line 97: https://github.com/adafruit/micropython-adafruit-ssd1306/blob/master/ssd1306.py#L97
scroll() function.
Regards,
Sara
Thank you Sara, I tried it with this code:
oled_width = 128 oled_height = 64 oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c) oled.text('Hello World!', 0, 0) oled.show() time.sleep(0.5) oled.scroll(0,20) oled.show() time.sleep(0.5)
But the first line will continue to be displayed. What have I done wrong?
Regards,
Konrad
Hi.
I experimented with the scroll() function and it scrolls x number of pixels to the right in relation to the text previous position. So, oled.scroll(0, 20) will place the text 20 pixels below in relation to its previous position.
The first argument refers to the pixels in the x axis (horizontal scrolling) and the second argument refers to the pixels in the y axis (vertical scolling).
If you want a continuous scrolling effect, you need something like this (for an horizontal scrolling).
while True: oled.text("Hello World!", 0, 0) for i in range(0, 164): oled.scroll(1,0) oled.show() time.sleep(0.01)
Call oled.show() just after calling the scroll() function.
I hope this helps.
Regards,
Sara