include int LED = 9; int x = 0; void setup() { pinMode (LED, OUTPUT); Wire.begin(9); Wire.onReceive(receiveEvent); Serial.begin(9600); } void receiveEvent(int bytes) { x = Wire.read(); } void loop() { int ledPWM = map(x, 0, 255, 0, 1023); analogWrite(LED, ledPWM); Serial.print("X is: "); Serial.println(x); Serial.print("PWM is: "); Serial.println(ledPWM); delay(1000); }