[HELP] PiBorg I2C communication Linux

Dear PiBorg,

I have a little trouble writing my own API to communicate with the motors via PiBorg Motorcontroller Reverse.
My code I am using.

https://github.com/Xhendos/GPIO/tree/master/Projects/PIBorgReverse

Its basicly at this part

if(write(file, writeBuffer, length) != length) 
     { 
         cout << write(file, writeBuffer, length) << endl;
         cout << "[SYSTEM] Error on writing to SLAVE. " << endl; 
     } 

Prints out: -1 and the error log.
What is the right writeBuffer to set up?

Thanks for the help anyway!

piborg's picture

Looking at the full code it looks like you forgot to set the length value.

It should be the number of values in writeBuffer.
Make sure you set the value before calling write.

Dear PiBorg,

My bad. In the actual code I had set the length.
I tried it again with different values but still getting error it could not write nor read.

I updated my github page https://github.com/Xhendos/GPIO/blob/master/Projects/PIBorgReverse/PIBor... with a read function aswell.

I hope you can tell me the right buffer and length value to write/read succesfull to the SLAVE.

Aditional information;
The slave I want to write to is the TT Geared Motor DC 6Voltage with 200 roads per minute.

piborg's picture

I have had another look at the code and I think you might have the wrong address value.

The default address for a PicoBorg Reverse is 0x44, not 0x40.

Thank you very much for always the fast replies.
A couple days ago when I started to wrote the code I did a check for busses found

i2cdetect -y 1

and thought it said 0x40.
I changed the code to 0x44 and it works flawless now, thanks

Subscribe to Comments for &quot;[HELP] PiBorg I2C communication Linux&quot;