I2C communication between esp01 and arduino uno

Hello everyone,

For the project I'm working on I would like to communicate with a ESP01 (master) and an arduino uno (slave). I've managed to get the ESP01 working on it's flash but not in the normal mode but I don't want to dig deeper in it to let the uno control it.

The communication should go as following (if possible) ESP01 sends an instruction byte 0x00 or 0x01.
-when 0x00 it requests data and the slave responds with 1 byte of data.
-when 0x01 it sends data, where the data is 1 byte of data.
after this it should stop the communication.

I've already looked multiple times in the MasterReader example of the Wire library but I still don't understand it such as the "while(1 < Wire.available())" and do I need this in my application?

Thank you for helping.

http://www.forward.com.au/pfod/ESP8266/GPIOpins/ESP8266_01_pin_magic.html