PyRaspBeta

← All practice problems

Raspberry Pi practice problem · Displays

Segment scroller

HardBudget $7Python · gpiozero

A TM1637 display (CLK GPIO23, DIO GPIO24, 3.3 V) and a button on GPIO17 (to GND, pull-up). The library has no scroll(), so write your own:

  • padded = " CAFE 1234 " (4 spaces, CAFE 1234, 4 spaces). Frame k shows padded[k:k + 4] — exactly those four characters, spaces included.
  • a new frame every 0.4 s (frame 0 at the start); after the last frame ( ) start again at frame 0
  • the button pauses scrolling (the current frame stays) and, pressed again, resumes: the next frame appears 0.4 s after the resuming press

The test presses at 2.1 s (during frame 5) and at 4.1 s.

More in Displays