File tree Expand file tree Collapse file tree
Matrix_7-Segment_LED_Backpack_Raspberry_Pi Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Basic example of using the Bi-color 24 segment bargraph display.
2+ # This example and library is meant to work with Adafruit CircuitPython API.
3+ # Author: Carter Nelson
4+ # License: Public Domain
5+
6+ import time
7+ import board
8+ import busio
9+
10+ # Import the Bicolor24 driver from the HT16K33 module
11+ from adafruit_ht16k33 .bargraph import Bicolor24
12+
13+ # Create the I2C interface
14+ i2c = busio .I2C (board .SCL , board .SDA )
15+
16+ # Create the LED bargraph class.
17+ bc24 = Bicolor24 (i2c )
18+
19+ # Set individual segments of bargraph
20+ bc24 [0 ] = bc24 .LED_RED
21+ bc24 [1 ] = bc24 .LED_GREEN
22+ bc24 [2 ] = bc24 .LED_YELLOW
23+
24+ time .sleep (2 )
25+
26+ # Turn them all off
27+ bc24 .fill (bc24 .LED_OFF )
28+
29+ # Turn them on in a loop
30+ for i in range (24 ):
31+ bc24 [i ] = bc24 .LED_RED
32+ time .sleep (0.1 )
33+ bc24 [i ] = bc24 .LED_OFF
34+
35+ time .sleep (1 )
36+
37+ # Fill the entrire bargraph
38+ bc24 .fill (bc24 .LED_GREEN )
You can’t perform that action at this time.
0 commit comments