I’ve spent most of the evening trying to get I2C working between the Arduino and a couple of I2C devices (a LCD output and a relay board) from Robot Electronics. I finally had to look at the source code for the Wire library that implements the TwoWire serial protocol for the Arduino, and found that the library correctly bit shifts the address one bit towards the MSB, but that means that you have to do the reverse bit shift to quote the address on the bus when making the library calls. It all has to do with the fact that it’s a 7 bit addressing system.
I did finally manage to get it to work by dividing all the addreses by two, so that’ll make it easier when I actually get the 6-7.2V supply working for the servo board for controlling the turnouts on the layout.
Bedtime now.
Hi.
I’m trying to interface an Arduino with an EEPROM over i2c using the wire library, and I’m getting some weird results… quite frankly, I have no idea what I’m doing. I have the two talking back and forth, but don’t really understand some things. Any chance you’d be able to tutor me a bit? I could really use the help.
Thanks, Scott.
Richard!
I was just googling for info on using arduinos to control an i²c bus… and I find myself looking at your blog.
Small world (wide web), eh?
Is it just me or is the Arduino Wire library simply maddening, particularly when trying to implement an I2C slave?? I’ve been banging my head against a wall to figure out the best way to get two AVRs talking to each other, using a combination of commands and different quantities of bytes… what a nightmare. 🙂