[HELP] PiBorg I2C communication Linux
Forums:
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
Sat, 08/27/2016 - 23:50
Permalink
Forgot to set the length
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
.Zhendos
Sun, 08/28/2016 - 15:51
Permalink
Length and buffer value?
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
Sun, 08/28/2016 - 23:36
Permalink
Wrong address?
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
, not0x40
.Zhendos
Mon, 08/29/2016 - 18:54
Permalink
Thanks
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
and thought it said 0x40.
I changed the code to 0x44 and it works flawless now, thanks