我正在尝试在RP4中使用MCP4728 DAC。我不能让它工作。连接映射: RP4 1 (3.3V)到1( 4728 )。4728,RP4 6 (GND)至10。在4728,RP4 3 (SDA)到3。在4728,RP4 5 (SCL)到2。地面在4728到4点。
已尝试使用以下代码:
import board
import busio
import adafruit_mcp4728
i2c = busio.I2C(board.SCL, board.SDA)
mcp4728 = adafruit_mcp4728.MCP4728(i2c)出现错误:No I2C device at address: 0x60
已尝试使用以下代码:
from smbus import SMBus
bus = SMBus(1) #indicates /dev/i2c-1
addr = 0x60
bus.write_byte(addr, 0x50)出现错误:[Errno 121] Remote I/O error
有什么想法吗?谢谢。
发布于 2021-11-10 12:38:53
这对我很有效。
# write to MCP4728
#for the first channel
command = 0x58
addr = 0x61 #bus address
bus = SMBus(1) #indicates /dev/i2c-1
bus.write_i2c_block_data(addr,command,[value_msb,value_lsb]) https://stackoverflow.com/questions/69734882
复制相似问题