There is a function in the Adafruit SSD1306 Library that prints a scrolling text. For example: display.startscrollright(0x00,0x0F);
will print a text scrolling towards the right. What are the arguments "0x00" and "0x0F" for and what kind of arguments are they?

- 8,705
- 21
- 30
- 42

- 101
- 1
- 6
1 Answers
display.startscrollright(0x00,0x0F); will print a text scrolling towards the right. What are the arguments "0x00" and "0x0F for and what kind of arguments are they?
The short answer is that those parameters define which parts of the display to scroll. Using display.startscrollright(0x00,0x0F)
will scroll the whole display, as I explain below.
You can learn about this yourself in these steps:
Go to the Adafruit SSD1306 Library source code.
Find the specific code for
display.startscrollright()
inAdafruit_SSD1306.cpp
:
// To scroll the whole display, run: display.startscrollright(0x00, 0x0F) <-- SEE THIS!!
void Adafruit_SSD1306::startscrollright(uint8_t start, uint8_t stop) {
TRANSACTION_START
static const uint8_t PROGMEM scrollList1a[] = {
SSD1306_RIGHT_HORIZONTAL_SCROLL,
0X00 };
ssd1306_commandList(scrollList1a, sizeof(scrollList1a));
ssd1306_command1(start);
ssd1306_command1(0X00);
ssd1306_command1(stop);
static const uint8_t PROGMEM scrollList1b[] = {
0X00,
0XFF,
SSD1306_ACTIVATE_SCROLL };
ssd1306_commandList(scrollList1b, sizeof(scrollList1b));
TRANSACTION_END
}
Notice that startscrollright(0x00,0x0F)
is specifically described in the code above as scrolling the whole display, so that might be all you were asking. But in case you wanted more explanation, read on.
From Adafruit_SSD1306.h
see that:
#define SSD1306_RIGHT_HORIZONTAL_SCROLL 0x26 ///< Init rt scroll
and
#define SSD1306_ACTIVATE_SCROLL 0x2F ///< Start scroll
As you see, the parameters start
and stop
are passed to the SSD1306 controller, as part of a 0x26
command sequence. Therefore...
Go to the SSD1306 datasheet, and look at the commands (
0x26
and0x2F
) being sent to that controller, by the Adafruit library code.For example, in the datasheet, command
26h
(i.e.0x26
) and its parameters are explained e.g.:
That part of the datasheet explains that command 26h
(i.e. 0x26
) sets up the horizontal scroll parameters and describes them.
Then command 2Fh
is also explained - this command actually starts the scrolling, after the setup has been done using command 26h
(or one of the other scrolling setup commands 27h, 29h, 2Ah
):
Then look at this table for more details about command 26h
:
You can see that the two parameters start
and stop
from that routine in the Adafruit library are actually B[2:0]
and D[2:0]
in that description i.e. they select which pages of the GDDRAM (i.e. which parts of the display) are scrolled. See:
The datasheet includes this example of scrolling only part of the display to the right - in the example it is only PAGE5
to PAGE7
towards the bottom of the screen, which are scrolled:
So that is the whole story - the library routine passes those parameters to the SSD1306 horizontal scrolling setup command, to define which part of the display to scroll.

- 17,231
- 5
- 37
- 58