BlinkMeetsI2C

From Wiki

Jump to: navigation, search

I wrote a simple hello-world style i2c program for the arduino.

Image:Blinki2c.jpg

its basically the arduino Blink example mixed together with the Wire examples. the i2c master sends a 1 over the wire each time it turns its LED on, and a 0 when it turns the LED off. the i2c slave listens endlessly for bytes on the wire, and uses them to turn its LED on or off.

So, if i2c works, what we should see is the two pin 13 LED's blinking in unison.

Contents

video

here is a video explaining the project: http://www.youtube.com/watch?v=QWZIyeX8-jo

source

here are the arduino sketches:

hex

for my implementation of this, I'm using boarduino's, and I don't have a bootloader programmed into the chips. accordingly, I use avrdude to program the hex files into the atmel chips using a usbtinyisp.

for those of you out there in a similar situation, or for those of you who fool around with atmel chips but don't have an arduino IDE set up, life would be easier if I just gave you the hex files rather than the code. here you go!

circuit

the circuit is dead-simple. just connect analog pin 4 of the master to analog pin 4 of the slave, and do the same for analog pin 5. connect both of those wires to the 5v bus via 10k pull-up resistors.

I'm using the boarduino for this example, which already has an LED on pin 13. if your arduino doesn't have that LED, you'll need to add one to both the master and slave.

Personal tools