Welcome to the Scroll pHAT documentation. This page will guide you through the methods available in the Scroll pHAT python library.

The Scroll pHAT provides a matrix of 55 white LED pixels that is ideal for writing messages, showing graphs, and drawing pictures. Use it to output your IP address, show CPU usage, or just play pong!

Set A Single Pixel In Buffer

Scroll pHAT uses white LEDs which can be either on or off.

When you set a pixel it will not immediately display on Scroll pHAT, you must call scrollphat.update().

scrollphat.set_pixel(x, y, value)[source]

Turn a specific pixel on or off

  • x – The horizontal position of the pixel
  • y – The vertical position of the pixel: 0 to 4
  • value – On/Off state: True/False

Set All Pixels In Buffer

scrollphat.set_pixels(handler, auto_update=False)[source]

Use a pixel shader function to set 11x5 pixels

Useful for displaying patterns and animations, or the result of simple functions. For example:

scrollphat.set_pixels(lambda x, y: (x + y) % 2, True)

Will display a check pattern.

  • handler – A function which accepts an x and y position, and returns True or False
  • auto_update – Whether to update Scroll pHAT after setting all pixels (default False)

Write A Text String

scrollphat.write_string(chars, x=0)[source]

Write a text string to the buffer

  • chars – Text string to write
  • x – Left offset in pixels

Display Buffer

All of your changes to Scroll pHAT are stored in a Python buffer. To display them on Scroll pHAT you must call scrollphat.update().


Update Scroll pHAT with the current buffer

Clear Buffer


Clear just the buffer, do not update Scroll pHAT

Clear Buffer And Display


Clear the buffer, and then update Scroll pHAT

Set The Brightness


Set the brightness of Scroll pHAT

Parameters:brightness – Brightness value: 0 to 255

Scroll The Buffer


Scroll the offset

Scroll pHAT displays an 11 column wide window into the buffer, which starts at the left offset.

Parameters:delta – Amount to scroll (default 1)

Scroll To A Position


Set the internal offset to a specific position

Parameters:pos – Position to set

Rotate The Display


Set the rotation of Scroll pHAT

Parameters:value – Rotate 180 degrees: True/False



ROTATE_180 = True