void loop() { // read the input pin val = analogRead(analogPin); // analogRead values go from 0 to 1023, analogWrite values from 0 to 255 analogWrite(ledPin, val / 4); } 314