#include // Include the Wire library for I2C communication #include // Include the Servo library for servo motor control Servo myServo; // Create a Servo object named myServo void setup() { Wire.begin(10); // Initialize I2C communication as master with address 10 myServo.attach(9); // Attach the servo to pin 9 myServo.write(0); // Set the initial position of the servo to 0 degrees Serial.begin(9600);// Initialize serial communication at 9600 baud rate } void loop() { Wire.requestFrom(9, 1); // Request 1 byte from the slave device with address 9 while (Wire.available()) { int data = Wire.read(); // Read the byte received from the slave Serial.print("Data:"); // Print "Data:" to serial monitor Serial.println(data); // Print the received data to serial monitor myServo.write(data); // Set the servo position based on the received data } delay(500); // Delay for 500 milliseconds }