]> vault307.fbx.one Git - Sensory_Wall.git/blob - circuitPython/testline.py
more sensory wall projects
[Sensory_Wall.git] / circuitPython / testline.py
1 # SPDX-FileCopyrightText: 2023 DJDevon3
2 # SPDX-License-Identifier: MIT
3 # Chaining 4 13x9 Matrix's to run sequentially (not simultaneously)
4
5 import board
6 from adafruit_led_animation.sequence import AnimationSequence
7 from adafruit_led_animation.animation.rainbowchase import RainbowChase
8 from adafruit_is31fl3741 import PREFER_BUFFER
9 from adafruit_is31fl3741.adafruit_rgbmatrixqt import Adafruit_RGBMatrixQT
10 from adafruit_is31fl3741.is31fl3741_pixelbuf import IS31FL3741_PixelBuf
11
12 # Initialize I2C Bus
13 i2c = board.STEMMA_I2C()
14 # i2c = board.I2C() # uses board.SCL and board.SDA
15
16 # Initialize each 13x9 Matrix
17 Matrix30 = Adafruit_RGBMatrixQT(i2c, address=0x30, allocate=PREFER_BUFFER)
18 Matrix30.set_led_scaling(0xFF)
19 Matrix30.global_current = 0x01
20 Matrix30.enable = True
21
22 Matrix31 = Adafruit_RGBMatrixQT(i2c, address=0x31, allocate=PREFER_BUFFER)
23 Matrix31.set_led_scaling(0xFF)
24 Matrix31.global_current = 0x01
25 Matrix31.enable = True
26
27 Matrix32 = Adafruit_RGBMatrixQT(i2c, address=0x32, allocate=PREFER_BUFFER)
28 Matrix32.set_led_scaling(0xFF)
29 Matrix32.global_current = 0x01
30 Matrix32.enable = True
31
32 Matrix33 = Adafruit_RGBMatrixQT(i2c, address=0x33, allocate=PREFER_BUFFER)
33 Matrix33.set_led_scaling(0xFF)
34 Matrix33.global_current = 0x01
35 Matrix33.enable = True
36
37 # Demo scrolling pixels
38 WIDTH = 13
39 HEIGHT = 9
40 LEDS_MAP = tuple(
41 (
42 address
43 for y in range(HEIGHT)
44 for x in range(WIDTH)
45 for address in Adafruit_RGBMatrixQT.pixel_addrs(x, y)
46 )
47 )
48 Matrix30_pixels = IS31FL3741_PixelBuf(Matrix30, LEDS_MAP, init=False, auto_write=False)
49 Matrix30_chase = RainbowChase(Matrix30_pixels, speed=0.1, size=1, spacing=3, step=8)
50
51 Matrix31_pixels = IS31FL3741_PixelBuf(Matrix31, LEDS_MAP, init=False, auto_write=False)
52 Matrix31_chase = RainbowChase(Matrix31_pixels, speed=0.1, size=1, spacing=3, step=8)
53
54 Matrix32_pixels = IS31FL3741_PixelBuf(Matrix32, LEDS_MAP, init=False, auto_write=False)
55 Matrix32_chase = RainbowChase(Matrix32_pixels, speed=0.1, size=1, spacing=3, step=8)
56
57 Matrix33_pixels = IS31FL3741_PixelBuf(Matrix33, LEDS_MAP, init=False, auto_write=False)
58 Matrix33_chase = RainbowChase(Matrix33_pixels, speed=0.1, size=1, spacing=3, step=8)
59
60 # Run animation on each 13x9 matrix sequentially
61 animations = AnimationSequence(
62 Matrix30_chase,
63 Matrix31_chase,
64 Matrix32_chase,
65 Matrix33_chase,
66 advance_interval=1,
67 auto_clear=False,
68 )
69 while True:
70 animations.animate()