Images that fill the display are fine, but the array is pretty small and we might want to display something bigger. A scrolling display is often the way to do it. To make a scrolling display there are the shift_into_left(stripe) and shift_into_right(stripe) methods.

The stripe parameter is a list of colors, one per pixel, that will get shifted onto the display with the first one at the top.

The examples below show counting from 0 to 63 (i.e. 6 bits worth) and shifting each number onto the display from the left and right, respectively.

Both examples use the numbers_to_pixels(x, color) function that converts the number x to a list of color values: the color parameter when a pixel should be on, and (0, 0, 0) when it should be off. See the section on stripes for more detail.

For example, numbers_to_pixels(5, (32, 32, 8) would result in ((0, 0, 0), (0, 0, 0), (0, 0, 0), (32, 32, 8), (0, 0, 0), (32, 32, 8))

import board
import dotstar_featherwing
import time

wing = dotstar_featherwing.DotstarFeatherwing(board.D13, board.D11)

# count from 0->63, shifting the binary pattern in from the left
while True:
    wing.clear()
    for x in range(64):
        wing.shift_into_left(wing.number_to_pixels(x, (64, 0, 0)))
        wing.show()
        time.sleep(0.2)
import board
import dotstar_featherwing
import time

wing = dotstar_featherwing.DotstarFeatherwing(board.D13, board.D11)

# count from 0->63, shifting the binary pattern in from the right
while True:
    wing.clear()
    for x in range(64):
        wing.shift_into_right(wing.number_to_pixels(x, (64, 0, 0)))
        wing.show()
        time.sleep(0.2)

This guide was first published on Dec 21, 2017. It was last updated on Dec 21, 2017.

This page (Scrolling) was last updated on Nov 20, 2021.

Text editor powered by tinymce.