#include <Wire.h>
int status=0;
void serial_printing_fn(int bytes){
String m="";
while (Wire.available()){
char c=Wire.read();
m+=c;
}
Serial.print("Command from master:")
Serial.println(m);
status=1;
}
void request_calback_fn(){
if(status==0):{
Wire.write("not completed");
}
else{
Wire.write("completed");
}
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
Wire.begin(21,22,0x08);
Wire.onReceive(serial_printing_fn);
Wire.onRequest(request_callback_fn):
}
void loop() {
}