|
3 | 3 | import busio
|
4 | 4 | import adafruit_is31fl3731
|
5 | 5 |
|
| 6 | +i2c = busio.I2C(board.SCL, board.SDA) |
| 7 | + |
6 | 8 | # arrow pattern in bits; top row-> bottom row, 8 bits in each row
|
7 | 9 | arrow = bytearray((0x08, 0x0c, 0xfe, 0xff, 0xfe, 0x0c, 0x08, 0x00, 0x00))
|
8 | 10 |
|
9 |
| -with busio.I2C(board.SCL, board.SDA) as i2c: |
10 |
| - # initial display using Feather CharlieWing LED 15 x 7 |
11 |
| - display = adafruit_is31fl3731.CharlieWing(i2c) |
12 |
| - # uncomment line if you are using Adafruit 16x9 Charlieplexed PWM LED Matrix |
13 |
| - #display = adafruit_is31fl3731.Matrix(i2c) |
| 11 | +# initial display using Feather CharlieWing LED 15 x 7 |
| 12 | +display = adafruit_is31fl3731.CharlieWing(i2c) |
| 13 | +# uncomment line if you are using Adafruit 16x9 Charlieplexed PWM LED Matrix |
| 14 | +#display = adafruit_is31fl3731.Matrix(i2c) |
| 15 | +# uncomment line if you are using Adafruit 16x9 Charlieplexed PWM LED Matrix |
| 16 | +#display = adafruit_is31fl3731.CharlieBonnet(i2c) |
| 17 | + |
14 | 18 |
|
15 |
| - # first load the frame with the arrows; moves the arrow to the right in each |
16 |
| - # frame |
17 |
| - display.sleep(True) # turn display off while frames are updated |
| 19 | +# first load the frame with the arrows; moves the arrow to the right in each |
| 20 | +# frame |
| 21 | +display.sleep(True) # turn display off while frames are updated |
| 22 | +for frame in range(8): |
| 23 | + display.frame(frame, show=False) |
| 24 | + display.fill(0) |
| 25 | + for y in range(display.height): |
| 26 | + row = arrow[y] |
| 27 | + for x in range(8): |
| 28 | + bit = 1 << (7-x) & row |
| 29 | + # display the pixel into selected frame with varying intensity |
| 30 | + if bit: |
| 31 | + display.pixel(x + frame, y, frame**2 + 1) |
| 32 | +display.sleep(False) |
| 33 | +# now tell the display to show the frame one at time |
| 34 | +while True: |
18 | 35 | for frame in range(8):
|
19 |
| - display.frame(frame, show=False) |
20 |
| - display.fill(0) |
21 |
| - for y in range(display.height): |
22 |
| - row = arrow[y] |
23 |
| - for x in range(8): |
24 |
| - bit = 1 << (7-x) & row |
25 |
| - # display the pixel into selected frame with varying intensity |
26 |
| - if bit: |
27 |
| - display.pixel(x + frame, y, frame**2 + 1) |
28 |
| - display.sleep(False) |
29 |
| - # now tell the display to show the frame one at time |
30 |
| - while True: |
31 |
| - for frame in range(8): |
32 |
| - display.frame(frame) |
33 |
| - time.sleep(.1) |
| 36 | + display.frame(frame) |
| 37 | + time.sleep(.1) |
0 commit comments