Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Read an I2C Portexpander
#!/bin/bash
ADDRESS=0x27
printf "76543210 76543210\n"
while :
do
v=$(i2cget -y 0 $ADDRESS 0x00 w)
echo ${v: -4:4} | xxd -r -p | xxd -b | awk '{split($0,a," "); printf "%s %s\r", a[2], a[3]}'
done
@c7h

This comment has been minimized.

Copy link
Owner Author

c7h commented Sep 6, 2018

Reads a 16 bit I2C portexpander like the PCF8575 and displays the result in bit representation.

$ ./read_portexpander.sh 
76543210 76543210
11111111 10011111
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.