Raspberry pi 在shell_exec中从i2c读取/写入特定引脚

Raspberry pi 在shell_exec中从i2c读取/写入特定引脚,raspberry-pi,i2c,shell-exec,Raspberry Pi,I2c,Shell Exec,有没有一种方法可以在不必更改/更新其他管脚的情况下写入Shell/bash中mcp23017芯片上的管脚 这就是我发现的 sudo i2cset -y 1 0x20 0x14 0x01 # Sets bus 0x20 port A to 00000001 在python中,我可以指定一个pin: bus_0 = IOPi(0x20) # Choose Chip bus_0.set_port_direction(0, 0x00) #Set port A/0 to Output(For all p

有没有一种方法可以在不必更改/更新其他管脚的情况下写入Shell/bash中mcp23017芯片上的管脚

这就是我发现的

sudo i2cset -y 1 0x20 0x14 0x01 # Sets bus 0x20 port A to 00000001
在python中,我可以指定一个pin:

bus_0 = IOPi(0x20) # Choose Chip
bus_0.set_port_direction(0, 0x00) #Set port A/0 to Output(For all pins)
bus_0.write_port(0, 0xFF) # Can write all pins 
bus_0.write_pin(1, 1) # can write specific pin
是否是编写从shell_exec获取输入并执行作业的脚本的唯一选项