• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

SSD1306 OLED scrolling text in micropython

Q&A Forum › Category: ESP32 › SSD1306 OLED scrolling text in micropython
0 Vote Up Vote Down
info8 asked 6 years ago

Hello, how can I scroll a text from left to right on the SSD1306 display. In MicroPython on an ESP32?

Question Tags: MicroPython
5 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 6 years ago

Yes.
See line 97: https://github.com/adafruit/micropython-adafruit-ssd1306/blob/master/ssd1306.py#L97
scroll() function.
Regards,
Sara

0 Vote Up Vote Down
info8 answered 6 years ago

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

0 Vote Up Vote Down
Sara Santos Staff answered 6 years ago

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

0 Vote Up Vote Down
info8 answered 6 years ago

Yes, Sara that helps me a lot. Thanks and Greetings

0 Vote Up Vote Down
Sara Santos Staff answered 6 years ago

That’s great!
I’ll mark this question as resolved.
If you need further help, you just need to open a new question.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.