Adafruit_Learning_System_Gu.../Custom_LED_Animations/conways/code.py
2024-10-31 15:20:39 -05:00

30 lines
743 B
Python

# SPDX-FileCopyrightText: 2024 Tim Cocks for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import board
import neopixel
from conways import ConwaysLifeAnimation
# Update to match the pin connected to your NeoPixels
pixel_pin = board.D10
# Update to match the number of NeoPixels you have connected
pixel_num = 32
# initialize the neopixels. Change out for dotstars if needed.
pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.02, auto_write=False)
initial_cells = [
(2, 1),
(3, 1),
(4, 1),
(5, 1),
(6, 1),
]
# initialize the animation
conways = ConwaysLifeAnimation(pixels, 1.0, 0xff00ff, 8, 4, initial_cells)
while True:
# call animation to show the next animation frame
conways.animate()