环境配置
驱动代码
import wiringpi
import argparse
import time
parser = argparse.ArgumentParser(description='')
parser.add_argument("--channel", type=int, default=1, help='specify the spi channel')
parser.add_argument("--port", type=int, default=0, help='specify the spi port')
parser.add_argument("--speed", type=int, default=6400000, help='specify the spi speed')
parser.add_argument("--mode", type=int, default=0, help='specify the spi mode')
args = parser.parse_args()
sig_1 = 0xf8
sig_0 = 0xc0
def flatten_arrays(arrays):
return [element for sublist in arrays for element in sublist]
class WS2812:
def __init__(self, led_num=10