Issue with I2C on BBB


I’m having an issue with the I2C-2 on my BBB. I’ve got this Lidar sensor ( which I’m trying to utilize but am getting lost on how to properly setup communication between the BBB and Lidar using I2C. I’ve essentially copy-pasted the code from this page:

The I2C’s are all setup and on (i2cdetect -l shows I2C-0, I2C-1, and I2C-2) and when I run the basic C program from before, thought it would give me some kind of output if I changed the address to its distance reading register (0x14). So, it establishes a connection to the bus but gives me a “Remote I/O Error”. Did some reading and thought it was because I was trying to read too quickly after writing to the I2C-2 bus (someone mentioned that on some other forum post) but when I put in a “sleep(1)” between the write and read, it still gave me the error.

I’m pretty new to the BBB and I2C, so I probably have a real misunderstanding of what I’m trying to do and am just looking for someone to put me on the right general direction with this.