我完全不知道如何让它发挥作用。
我有一个 USB ft232h 分线板,它应该支持 i2c 和 gpio。我可以让基本的 gpio 设备正常工作,但是我有很多关于 I2C LCD 的问题,这些问题也应该适合。
当我这样做时i2cdetect -y 1
(我使用的是 Raspberry Pi 3 Model B Plus Rev 1.3),我只看到以下内容。
$ i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
但是,当我从 python 运行以下脚本时
import board
import time
import busio
i2c = busio.I2C(board.SCL, board.SDA)
while not i2c.try_lock():
pass
while True:
print("I2C addresses found:", [hex(device_address)
for device_address in i2c.scan()])
time.sleep(2)
我懂了:
$ python i2ctest.py
I2C addresses found: ['0x20']
所以我知道 LCD 通过 busio 对 python 是可见的。这就是我卡住的地方。我不知道如何写入这个 LCD。
这个液晶显示器是DFRobot dfr0063,它使用PCF8574 i2c扩展芯片。这是一个问题,因为adafruit_character_lcd
带有电路 python 的库仅支持 MCP230xx 芯片。所以,我当前的脚本不起作用。
import board
import busio
import time
import adafruit_character_lcd.character_lcd_i2c as character_lcd
i2c = busio.I2C(board.SCL, board.SDA)
print(i2c)
lcd = character_lcd.Character_LCD_I2C(i2c, 16, 2)
while True:
print("hello worlding")
lcd.message = 'Hello\n World!'
time.sleep(5.0)
print("sorta working")
lcd.message = 'I can sorta work!'
time.sleep(5.0)
有没有人能够让 rplcd 通过 ft232h 芯片工作?我一直无法弄清楚如何。我还尝试研究使用 character_LCD https://github.com/dhalbert/CircuitPython_LCD库的这个分支,但这也没有奏效。我只是收到“微控制器错误,不支持 ft232h”消息。