def swarm(intensity, bounds, count, maxv, varyv, delay, color, **kwargs): # setup the port and LED device serial = busio.SPI(clk, MOSI=din) device = matrices.Matrix8x8(serial, cs) device.brightness(intensity) device.fill(0) ffs = Fireflies(bounds, count, maxv, varyv) canvas = None renderer = FireflyRendererLed_AF(canvas, device, bounds, ffs, color, **kwargs) while(True): deque(map(lambda firefly: firefly.move(), ffs.flies)) renderer.render() time.sleep(delay)
from analogio import AnalogIn msg7RESET = DigitalInOut(board.D3) msg7RESET.direction = Direction.OUTPUT msg7Strobe = DigitalInOut(board.D4) msg7Strobe.direction = Direction.OUTPUT msg7DCout = AnalogIn(board.A3) # reset, strobe and DC out pins for MSGEQ7 clk = RX din = TX cs = DigitalInOut(board.A2) # pins for the MAX7219 spi = busio.SPI(clk, MOSI=din) display = matrices.Matrix8x8(spi, cs) # SPI setup for MAX7219 baseVal = 21000 # base value for use with some math in the loop. 21000 because it's divisible by 7 def getVoltage(pin): return (pin.value) # function to get the analog value from DC out while True: msg7RESET.value = True time.sleep(.00001) msg7RESET.value = False # resets the Reset pin on MSGEQ7 display.brightness(3) # brightness for the matrix
from adafruit_max7219 import matrices from board import TX, RX, A2 import busio import digitalio import time clk = RX din = TX cs = digitalio.DigitalInOut(A2) spi = busio.SPI(clk, MOSI=din) display = matrices.Matrix8x8(spi, cs) while True: display.brightness(3) display.fill(1) display.pixel(3, 3) display.pixel(3, 4) display.pixel(4, 3) display.pixel(4, 4) display.show() time.sleep(3.0) display.clear_all() s = 'Hello, World!' for c in range(len(s) * 8): display.fill(0) display.text(s, -c, 0) display.show() time.sleep(0.25)
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # SPDX-License-Identifier: MIT import time import board import digitalio from adafruit_max7219 import matrices # You may need to change the chip select pin depending on your wiring spi = board.SPI() cs = digitalio.DigitalInOut(board.D4) matrix = matrices.Matrix8x8(spi, cs) while True: print("Cycle start") # all lit up matrix.fill(True) matrix.show() time.sleep(0.5) # all off matrix.fill(False) matrix.show() time.sleep(0.5) # one column of leds lit for i in range(8): matrix.pixel(1, i, 1) matrix.show() time.sleep(0.5)