5

I am testing out some I2C connected hardware and my C program is working fine using Wiring Pi. However, what I wanted to do was read a byte or write a byte to the slave device from the shell. I looked at Wiring Pi's gpio command but couldn't see any obvious flags to allow it to read and write from I2C. Does anyone know of a shell command that I can use to read and write data through I2C that runs on Raspbian on the Pi?

6
sudo apt-get install i2c-tools

Then use i2cset, i2cget, i2cdump.

man i2cset # for help
man i2cget # for help
man i2cdump # for help

Aternatively my pigpio library supports I2C from the command line usings pigs, see the i2c* commands, e.g. i2co.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.