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?

Kolban
  • 1,784
  • 2
  • 16
  • 28

1 Answers1

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.

joan
  • 71,024
  • 5
  • 73
  • 106