Society of Robots - Robot Forum

Software => Software => Topic started by: Invicta on August 25, 2010, 04:39:38 PM

Title: Converting Arduino I2C code for use with Webbotlib
Post by: Invicta on August 25, 2010, 04:39:38 PM
Hi all

I wish to rewrite some Arduino I2C code for use with Webbotlib. The Arduino environment provides a Wire Library that allows you to communicate with I2C / TWI devices. Are there equivalent Webbotlib I2C functions for these Arduino Wire Library Functions:

Wire.begin()
Wire.beginTransmission(address)
Wire.send(address)
Wire.requestFrom(address, count)
Wire.available()
Wire.receive()
Wire.endTransmission()

Thanks
 
Title: Re: Converting Arduino I2C code for use with Webbotlib
Post by: madsci1016 on August 25, 2010, 05:59:50 PM
Did you go through the pdf before posting this question? (my guess is no)

Quote

Standard Function Summary
boolean i2cMasterWriteRegisters(uint8_t deviceAddr, uint8_t startReg,
size_t numBytes, const uint8_t* data)

boolean i2cMasterWriteRegister(uint8_t deviceAddr, uint8_t reg, uint8_t
value)

boolean i2cMasterReadRegisters(uint8_t deviceAddr, uint8_t startReg,
size_t numBytes, uint8_t* data)

i2cSetBitrate(uint16_t bitrateKHz)

boolean i2cMasterSend(uint8_t deviceAddr, size_t length, const uint8_t*
data)

boolean i2cMasterReceive(uint8_t deviceAddr, size_t length, uint8_t *data)

boolean i2cMasterSendWithPrefix(uint8_t deviceAddr, size_t prefixLen,
const uint8_t* prefix, size_t length, const uint8_t* data)

boolean i2cMasterTransfer(uint8_t deviceAddr, size_t wlen, const uint8_t
*wdata, size_t rlen, uint8_t * rdata)
Title: Re: Converting Arduino I2C code for use with Webbotlib
Post by: Invicta on August 26, 2010, 08:22:36 AM
@madsci1016

In the light of a fresh day; your guess was correct. It was late, I was tired, I forgot RTFM, yada yada yada....................................

I accept 6 lashes, sorry.
Title: Re: Converting Arduino I2C code for use with Webbotlib
Post by: madsci1016 on August 26, 2010, 08:48:04 AM
no worries.

 In my opinion the PDF is very hard to search through. I've been suggesting to Webbot to start online docs for a while now, something more google-able.
Title: Re: Converting Arduino I2C code for use with Webbotlib
Post by: Invicta on August 26, 2010, 09:45:14 AM

Webbot has an online version of the Webbotlib at:

http://webbot.org.uk/WebbotLibDocs/object.jsp?id=0 (http://webbot.org.uk/WebbotLibDocs/object.jsp?id=0)

It is fully google-able at all levels.

Have fun.

p.s. I found it very useful as my computer at work blocks access to the source for Webbotlib.
Title: Re: Converting Arduino I2C code for use with Webbotlib
Post by: madsci1016 on August 26, 2010, 11:35:40 AM
O I know. When I say a while, I mean a long while.

That's another lashing for not googling btw. :P