Created
September 6, 2018 11:08
-
-
Save c7h/d72522802deb0b878e99ae70f3a18326 to your computer and use it in GitHub Desktop.
Read an I2C Portexpander
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reads a 16 bit I2C portexpander like the PCF8575 and displays the result in bit representation.