hi and good morning, i'm a newbie in embedded programing and arduino, and now, i'm using arduino uno for my study, the problem is, i dont know how/where to begin for i2c, i already look for tutorial at arduino tutorial/forum and http://www.gammon.com.au/forum/?id=10896, but i don't understand it.

i want to connect arduino 1 and arduino 2, where's arduino 1 have a switch, when the swicth is press it can give a signal to arduino 2 to on the led, when the switch is release the led at arduino 2 will off.

1. the program at aduino 1 is master, and arduino 2 is slave, when i push the pushbutton at master(arduino1), nothing happen at slave(i mean no led on at arduino 2,) the led at arduino 1 to indicate if the pushbutton is push at master, and the arduino 2 appear the result with led on or off

The master code sends a HIGH but never sends a LOW.It also sends lots and lots of HIGHs for as long as the button returns HIGH. How are the buttons wired? It is best to wire then between input and ground and enable the internal pull up resistors.Also do something at the master end so you can see it is sending something, like toggle the LED.

for this recievEvent function it is compulsary to add void receiveEvent(int howMany)

Yes it is known as a call back function, it is triggered when the I2C circuits detect something arriving.

Quote

and to write the while (Wire.available() > 0)

The while is a command that causes a loop to happen, it is used here to ensure that you gather all the bytes that are currently waiting in the I2C buffer. So it is not compulsory but you need to replace it with something that will do the same job.

boolean b = Wire.receive(); // this alsoThis creates a variable of type boolean to put the received byte from the I2C interface into. It needs to go somewhere and in this example you only need a logic variable (boolean) that is high or low.