Help using I2C and a LCD display

Hello, I need your help I am trying to do a simple program.. the setup is as follows: I have two arduinos one transmits via I2C to the other arduino.. and the recieving arduino displays the message on an LCD display.

I already have the i2Cup and running.. the code of the arduino that transmit the data is:
#include <Wire.h>

int x;
void setup()
{
Wire.begin(); // join i2c bus (address optional for master)
}

void loop()
{
Wire.beginTransmission(4); // transmit to device #4
Wire.send("TEST1 "); // sends six bytes
Wire.send(x); // sends int
Wire.endTransmission(); // stop transmitting
x++; //same: x=x+1;
delay(500); //:stuck_out_tongue:
}

The problem is the receiving arduino.. the code of the recieving arduino is the following:

#include <Wire.h>
#include <LiquidCrystal.h> //include LiquidCrystal library

LiquidCrystal lcd = LiquidCrystal(); //create a LiquidCrystal object to control an LCD
char string1[] = "Hello!"; //variable to store the string "Hello!"
int ledPin = 13;
void setup()
{

Wire.begin(4); // join i2c bus with address #4
Wire.onReceive(receiveEvent); // register event
Serial.begin(9600); // start serial for output
lcd.init(); //initialize the LCD
}

void loop()
{
delay(100);

}

// function that executes whenever data is received from master
// this function is registered as an event, see setup()
void receiveEvent(int howMany)
{
digitalWrite(ledPin,HIGH); //turn on an LED for debugging
lcd.clear(); //clear the display
delay(1000); //delay 1000 ms to view change
lcd.printIn(string1); //send the string to the LCD
delay(1000); //delay 1000 ms to view change
}

In theory when an event is recieved from the master arduino.. the slave arduino automatically jumps at the receivedEvent handler or rutine.. but this is ont happeningand i dont know why.. the only thing i get on my lcd display is a cursor because of the lcd.init code line at the setup..

any ideas why this doesnt work.. or do anybody knows a better way to do what i am trying to accomplish??

thanks in advance

You shouldn't delay, and spend a long time in your interrupts. Try setting a flag instead, and then operating when that flag changes, for example:

bool got_event = false;

...

void loop() 
{

 if( got_event == true ) 
 {

   digitalWrite(13, HIGH);

   lcd.clear();
   lcd.printIn("Received");

   got_event = false;
 }

 delay(1000);
}


void receiveEvent(int howMany) 
{
 
  got_event = true;
}

!c