/* Analog Input - Analog Output * * */ int potPin = 5; // select the input pin for the potentiometer int ledPin = 10; // select the pin for the LED int val = 0; // variable to store the value coming from the sensor void setup() { beginSerial(9600); pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT } void loop() { val = analogRead(potPin); // read the value from the sensor printInteger(val); // Example identifier for the sensor serialWrite(10); serialWrite(13); delay(100); analogWrite(ledPin, val / 4); //the divde by 4 is there to keep the value between 0-255 }