Reply To: How to Open I2C Bus

Home Forums Forums General discussion How to Open I2C Bus Reply To: How to Open I2C Bus

#4053
Patrick
Participant

Yes, i did. I was able to get the addresses ๐Ÿ™‚

My concern now is the next step which says:

— First, you need to open the I2C bus device file, as follows;

char filename[20];
sprintf(filename, “/dev/i2c-%d”, 1);
file = open(filename, O_RDWR);
if (file<0) {
printf(“Unable to open I2C bus!”);
exit(1);
}

How do I exactly do this? shall i type it on lxterminal? or make file. and the codes are “C”.. so is there a need to install cmake? Please help me understand, thank you.

Blip, blop, bloop…