为了之后做甲醛探测买了一块显示频:SSD1331。结果买回来不会接线。下面这个链接非常好用,最赞的是那个网页上代码SSD1331.py, 基本改一下针脚,就妥妥的了。注意,这次的针脚不是物理数针啦:
https://gist.github.com/TheRayTracer/dd12c498e3ecb9b8b47f
不过介于他用的还是一代。我这里就记录一下二代40针的接线方法。
pin VCC -> pin1 3v3
pin GND -> pin 6 ground
pin NC is not connected to any pin on Rpi
pin DIN -> pin 19 SPI_MOSI
pin CLK -> pin 23 SPI_CLK
pin CS -> pin 11 GPIO 17
pin D/C -> pin 13 GPIO 27
pin RES -> pin 15 GPIO 22
import SSD1331
import datetime
import time
import math
SSD1331_PIN_CS = 17
SSD1331_PIN_DC = 27
SSD1331_PIN_RST = 22
if __name__ == '__main__':
device = SSD1331.SSD1331(SSD1331_PIN_DC, SSD1331_PIN_RST, SSD1331_PIN_CS)
try:
device.EnableDisplay(True)
device.Clear()
today_play = "Have fun there!"
while True:
device.DrawString(8, 35, today_play, SSD1331.COLOR_PURPLE)
time.sleep(0.5)
finally:
device.EnableDisplay(False)
device.Remove()
图丑? 对,其实主要为了放那个猫…
2017-05-22:国内的源-https://git.coding.net/MichShell/Raspberry-Pi-SSD1331.git