使用Python模块SMBus,Raspberry Pi和Arduino输入/输出错误

hol*_*son 9 python arduino raspberry-pi

我已经将Raspberry Pi和Rainbowduino连接到一个自制的I²C级别移位器,并安装了Python模块SMBus,Raspberry Pi可以与Rainbowduino进行通信,但是在尝试命令时我经常会收到输入/输出错误消息bus.write_i2c_block_data(address, signal, data).

它说:

IOError:[Errno 5]输入/输出错误

为什么会发生这种情况?如何修复或忽略这些错误?

otm*_*ger 1

根据您的 RPi,您可以使用bus = SMBus(0)或bus = SMBus(1)来初始化 SMBus。

我希望这能解决您的问题。