Comment obtenir l'entrée MCP23017 dans la coque binaire

# assuming chip is addressed to 0x20 
# to setup
sudo i2cset -y 1 0x20 0x00 0x00
# replace 1 with zero on rev1 pi
# iodira is 0x00 and iodirb is 0x01
# setting all pins on gpa to input
# echo as binary                  address GPIOA is 0x12 and GPIOB is 0x13
echo "ibase=16;obase=2;$(i2cget -y 1 0x20 0x12 b | cut -c3-4)"|bc | BC_LINE_LENGTH=9999 bc | awk '{ printf "%08d\n", $0 }' 
# replace 1 with zero on rev1 pi
# Registers are shown on page 16 Table 3-3 of the data sheet https://ww1.microchip.com/downloads/en/devicedoc/20001952c.pdf
Laith Striegher