Raspberry Pi C++ I2C/SPI Examples -


hello , please not delete right away. i'm having trouble finding code examples i2c/spi programming on raspberry pi using c++. i've looked @ wiringpi , other sources don't give documentation source code like. has found pleasant examples in either documented source code or video explanations? if have please share link?

thank you!

doing i2c in c on raspberry pi easy -- need ordinary low-level file operations -- open, read, write, etc.

first open appropriate device:

int f = open ("/dev/i2c-1", o_rdwr); 

then use ioctl() set i2c device address:

ioctl (f, i2c_slave, address); 

then use ordinary read() , write() calls send , receive data.

the hard part understanding data protocol of device -- may, or may not, documented. rpi, many vendors provide python programming examples, have reverse-engineer actual protocol python code.

i've used method interfacing manner of devices rpi -- displays, motors, sensors, etc. honestly, reading , writing i2c bus easy part of job :)


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -