lcb163 发表于 2019-1-9 13:18:18

DIY 8×8 LED点阵模块

材料:Max7219芯片(SOP-24贴片)1片10K电阻(0805贴片)1个瓷片电容(104pf)1个二极管1N4148 1个MAX7219 8*8点阵PCB板1片8×8共阴极LED点阵(3.2×3.2mm 1088AS)1个插针若干焊锡膏(低温 138°)工具:       热风枪       电烙铁制作步骤:1、给PCB板中的Max7219芯片引脚,电阻引脚涂上一层焊锡膏,可以先将所有引脚区都涂上锡膏,然后仔细刮去非引脚部分的焊锡。2、将热风枪温度调到300°左右,用镊子按住芯片,对引脚吹风加热。3、焊好芯片和电阻后,用电烙铁焊上剩余的元件及插针。4、插入8×8共阴极LED点阵。5、连接上WEMOS Mini D1芯片并写入程序测试。
from machine import Pin,SPI
import time
DECODEMODE=const(9)
INTENSITY=const(10)
SCANLIMIT=const(11)
SHUTDOWN=const(12)
DISPLAYTEST=const(15)
sprite=(
(0x30,0x7c,0xae,0x3e,0x3e,0xae,0x7c,0x30),
(0x18,0xbe,0x57,0x1f,0x1f,0x57,0xbe,0x18),
(0x30,0xbc,0x6e,0x3e,0x3e,0x6e,0xbc,0x30),
(0x18,0x9e,0x57,0xbf,0xbf,0x57,0x9e,0x18)
)
def max7219(reg,data):
cs.value(0)
spi.write(bytes())
cs.value(1)
def init():
for reg,data in (
    (DISPLAYTEST,0),
    (SCANLIMIT,7),
    (INTENSITY,8),
    (DECODEMODE,0),
    (SHUTDOWN,1)
):
    max7219(reg,data)
def clear():
for i in range(8):
    max7219(i+1,0)
def animate():
for i in range(4):
    for j in range(8):
      max7219(j+1,sprite)
    time.sleep(0.3)
cs=Pin(15,Pin.OUT)
spi=SPI(1, baudrate=1000000) #若使用默认的baudrate,刷新太快
try:
init()
time.sleep(3)
while True:
    animate()
finally:
clear()
spi.deinit()


页: [1]
查看完整版本: DIY 8×8 LED点阵模块