I went through this problem recently. Your slave needs two functions: one for sending and the other for receiving data.
// function: what to do when asked for data
void requestEvent() {
Wire.write(t);
}
// what to do when receiving data from master
void receiveEvent(int howMany)
{Val = Wire.read();}
Here is a code that works both ways of i2c communication in a single code
Sending and receiving different types of data via I2C in ArduinoSending and receiving different types of data via I2C in Arduino