问题描述
我完全不知道如何让它发挥作用。
我有一个假设支持 i2c 和 gpio 的 USB ft232h 分线板。我可以让基本的 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。
这个LCD是DFRobot dfr0063,它使用PCF8574 i2c扩展器芯片。这是一个问题,因为带有电路 python 的 adafruit_character_lcd
库仅支持 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)
有没有人能够通过 ft232h 芯片让 rplcd 工作?我一直无法弄清楚如何。我也尝试研究使用 character_LCD https://github.com/dhalbert/CircuitPython_LCD 库的这个分支,但这也没有奏效。我刚刚收到一条“微控制器错误,不支持 ft232h”消息。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)