Horje
how to get mcp23017 input in binary shell Code Example
how to get mcp23017 input in binary shell
# 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




Shell

Related
venv git Code Example venv git Code Example
Delta compression using up to 4 threads Code Example Delta compression using up to 4 threads Code Example
nx test lib Code Example nx test lib Code Example
vim insert result of shell command Code Example vim insert result of shell command Code Example
uninstall vmware workstation arch linux Code Example uninstall vmware workstation arch linux Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11