#include #include LiquidCrystal lcd(2, 7, 8, 9, 10, 11); byte SlaveReceived; void setup() { Serial.begin(9600); Wire.begin(8); Wire.onReceive(receiveEvent); Wire.onRequest(requestEvent); lcd.begin(16,2); //Initilize LCD display lcd.setCursor(0,0); //Sets Cursor at first line of Display lcd.print("Peppe8o"); //Prints Peppe8o in LCD lcd.setCursor(0,1); //Sets Cursor at second line of Display lcd.print("I2C 2 ARDUINO"); //Prints I2C ARDUINO in LCD delay(5000); //Delay for 5 seconds lcd.clear(); //Clears LCD display } void requestEvent() { int potvalue = analogRead(A0); byte SlaveSend = map(potvalue,0,1023,0,127); Wire.write(SlaveSend); } void receiveEvent (int howMany) { SlaveReceived = Wire.read(); } void loop(void) { lcd.setCursor(0,0); //Sets Currsor at line one of LCD lcd.print(">> Slave <<"); //Prints >> Slave << at LCD lcd.setCursor(0,1); //Sets Cursor at line two of LCD lcd.print("MasterVal:"); //Prints MasterVal: in LCD lcd.print(SlaveReceived); //Prints SlaveReceived value in LCD received from Master Serial.println("Slave Received From Master:"); //Prints in Serial Monitor Serial.println(SlaveReceived); delay(500); lcd.clear(); }