Master Write and Slave Read between two arduino

I have problem when make I2C between two arduino for making led blink in Slave and Master be Transmission pulse

Hi, welcome to the forum.

Well, the onReceive function in the Slave may not use a delay.
It is possible to invert the led, instead of a blink.
It is also possible to set a flag, and use millis() in the loop() to create a delay for the led to be on.

Could you show your sketch of the Master and Slave between < code > and < / code > tags. There is a button for the code tags, the scroll with the “<>”.

// it is Master Code
#include <Wire.h>
int pulse = 5;

void setup()
{
Wire.begin(); // join i2c bus (address optional for master)
pinMode(pulse, INPUT);
}

int x;

void loop()
{
//delay(1);

int x = digitalRead(pulse);
Wire.beginTransmission(4); // transmit to device #4
Wire.write(x); // sends one byte
Wire.endTransmission(); // stop transmitting
}

// it is Slave Code
#include <Wire.h>

int ledPin = 13;

void setup()
{
pinMode(ledPin, OUTPUT);
Wire.begin(4); // join i2c bus with address #4
Wire.onReceive(receiveEvent); // register event
}

void loop()
{
}

// function that executes whenever data is received from master
// this function is registered as an event, see setup()
void receiveEvent(int howMany)
{
while(Wire.available()) // loop through all but the last
{
int x = Wire.read(); // receive byte as an integer
digitalWrite(ledPin,x);
}
}

I think it should work. You could try the i2c_scanner in the Master to see if the I2C bus is working. The i2c_scanner should find address 4. Google for : arduino playground i2c scanner

The Master keeps on transmitting at a high rate. Could you add "delay(100) ;" to the loop ? Then only 10 times a second something is transmitted.

actualy I have simulation It at the Proteus but it can't blink the Led. I will try again

Simulations don't work. Really, they don't. You can find many questions about simulations that don't work on this forum.

yes sure I have do it but can't work at the simulation