Writing the drivers for the giant seven-segment display
In the previous section, we wired up the display. Now, we need to write the drivers to test the display. We ported the C++ code provided by SparkFun to CircuitPython:
- The first step is to import all the required modules for the driver:
import board import busio import time from digitalio import DigitalInOut, Direction, Pull
- We declare the latch, clock, and data pins and set them up as output pins. We also set them all to low:
latch = DigitalInOut(board.GP22) clock = DigitalInOut(board.GP26) data = DigitalInOut(board.GP27) latch.direction = Direction.OUTPUT clock.direction = Direction.OUTPUT data.direction = Direction.OUTPUT latch.value = False clock.value = False data.value = False
- The
post_number
function is used to display a number, decimal place, and so on. This is accomplished by turning on the corresponding segments of the digit. For example, in order to display the number 1, we need to turn on the B and C segments...