Hi, I’m a new programmer and i’m having trouble using the I2C library for librobotcontrol. I’m not sure if i’m using it correctly. I am testing out a an accelerometer mpu6050.
So far I have these functions that should open and start communication with the chip however I keep receiving no bytes.
ERROR: in rc_i2c_read_bytes, received -1 bytes from device, expected 6
I left out the other parts from the template and just left the stuff using i2c.
So far In C I have:
Thank you for your reply. I was actually just reading in an external sensor and was practicing on using the external I2C BUS. I don’t think I understand how the read and write functions work. I’m assuming when I use the read bytes function. It requests data from the first register and the next one and the next one ect… when using “rc_i2c_read_bytes(I2C_BUS, 0x3B,6, data);” For instance it will go from 0x3B to 0x3C to 0x3D up till 0x40
The way I have it now. I am getting data back but it is garbage. I am expecting something around 0,0,9.81 for x,y,z respectively but i’m getting around 1,2,3 for x,y,z. When using rc_i2c_read_bytes do I need to talk and read from each register directly?