Arduino Tutorial #10: Arduino To Arduino I2C

People Who Liked This Video Also Liked

Arduino Tutorial #10: Arduino to Arduino I2C
Arduino Tutorial #10: Arduino to Arduino I2C
Curso de Arduino 10: Ping
Curso de Arduino 10: Ping
Tutorial 10 for Arduino: Interrupts and Hardware Debouncing
Tutorial 10 for Arduino: Interrupts and Hardware Debouncing
Arduino Tutorial - 10. Der Schrittmotor (mit Adafruit Shield) (#10)
Arduino Tutorial - 10. Der Schrittmotor (mit Adafruit Shield) (#10)
Tutorial 10: P6 - AnalogInOutSerial Arduino Tutorial
Tutorial 10: P6 - AnalogInOutSerial Arduino Tutorial

Did this video help you?

Marco Tricca: Hi, very nice video
what about merge those 2 sketches?
I need to have always connected 3 to 5 arduino for R2D2 project.
one master, slaves would be controlling motors, head, sounds.
suggestions on how continuously reading infrared sensors from slave and control movements(motors) ?


Fahmy Izzuddin (James): hi, need some help. Do we need to upload the sketch of slave to random comport as long as it is not the connected arduino?

Ken Franco: Can you use the "INPUT_PULLUP" command instead of the two external 4.7k pull up resistors ?

ParanoidAndroid86: hi
great vid
i was looking for a way to pass an received char array (that i've send from my leonardoto my gsm shield equipped mega over i2c) to my sendSMS(needs char array)
or to ask in another way: to make the receive event return my char array? (pointers?)

any reference you could guide me to?
thx anyways and keep on the good stuff

Scientist Razz: Thanks. That helped.

Fatih GÜMÜŞ: what if I want to send a 240x320 array (one component of a picture) through this line to another Arduino with using Arduino UNO or equivalent?
And also what will be the fps rate average in this case (if you ever tried anything like this)?

Naten Baptista: Worked great as simple Master Send & Slave Listen only configuration.
Used the MEGA 2560(Master) and MicroView(Slave).
Initially it did not work because I had connected A4 & A5 instead of using the dedicated communication pins SDA & SCL on the MEGA.
But after that it worked just fine.
Thanks for taking the pain to create this video.

ZVG: Can you pls! do an example using i2c with three arduinos where one master polls two slave slaves who send a couple of floats back to the master.

Robelle Ann Lipura: is this working between two arduinos?

Thomy Schumaker: Hi, I'm hoping you might be able to help, here is my code for the slave in trying to receive data from the master, and below it is the error I'm getting with a <--- indicating where in the code its highlighting the error. Everything that I've looked up is showing I have all the code correct and I can't seem to find anyone with this same error with this variable, it's really got me stumped!

// I2C Slave Code (Mini)

void setup() 
  Wire.onReceive(receiveEvent); //register event   <------------

void loop() 
    void receiveEvent(int howMany);
        char c =;
        if(c == 'H')
        else if(c == 'L')

'receiveEvent' was not declared in this scope

Slave.ino: In function 'void setup()':
Slave:8: error: 'receiveEvent' was not declared in this scope
Slave.ino: At global scope:
Slave:20: error: expected unqualified-id before '{' token

magnus östgren: Nice tutorial. But so mutch unneccesary code. Why make an IF statment when you could just do wire.write(c); inte the uno code

John Spuzzum: This is a great tutorial.. I just wish I knew coding a bit better. I'm currently trying to add a 2nd Atmega328 to the DIY Arduino Uno that I made to run high powered LEDs, but my script fades up and down like sunrise & sunset, with each string's on/off times 15 minutes less than each other, all configured by the user seting the main on/off times through the controller, with all datas stored in the EEPROM. Problem is.. the 328 only has 6 pwm pins, and I kinda need more. That's where the $4 Atmega328 chip as a slave sounds better than a $60 Arduino Mega.

I understand the coding enough to where I can just put the same LED commands from the master to the slave.. but it's the determining the LightsOn/LightsOff times from the master to the slave I'm confused about. I can set an "if" staement that can start LightsOn time, but it can't perform it's fade to sunset countdown if it doesn't know when sunset is.. which is held in the master's EEPROM. And I don't want to limit the device to a certain daylength.. otherwise it's just as easy as to do the math in the slave's script.

Is there a way where the master can talk with the slave's EEPROM? It would be nice if they could be combined as one. :P

Hans de Bruin (Ctrl-Alt-Dude):  It didn't work on my setup. The reason was that for some reason nothing prints to serial when I put it in void setup.
When I move the Write.requestFrom to void loop it works fine.
I haven't figured out yet why this is...

Vajira Lasantha: Thank you for the video. I'm gonna work on a project where an Attiny85 should send data to an Atmega328 via serial connection. Is it possible to use I2C for this? Thanks again. 

float: legend! Thanks for the clear and concise tutorials... 

Christo Pretorius: Thanks

Daniel Wekesa: This stuff doesn't work....

Fabio Ruiz: very useful, thank you!

PJ Jones: Hi Again,
Can you do a tutorial the same as this one but using a raspberry pi as master instead of the arduino. Can you use python please.
Or is this too much to ask of you. I only ask as there is no one else that has done this.
Thanks ever so much - pj

bas k: I did exactly the same with my mega and uno, it does not work. The led is not turning on ( i tested it, it is not the led)
Arduino Tutorial #10: Arduino to Arduino I2C 5 out of 5

Featured Video

How to Insulate Walls

Arduino Tutorial #10: Arduino to Arduino I2C