----------------------------------------------------------------------------------------------------------------------------------------
CODE:
int potPin = 2; // select the input pin for the potentiometer
int ledPin = 11; // select the pin for the LED
int val = 0; // variable to store the value coming from the sensor
int por = 0;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT
}
void loop() {
val = analogRead(potPin); // read the value from the sensor
Serial.println (val, DEC);
if (val>0)
por = val/4;
analogWrite(ledPin, por);
//val = analogRead(por);
}
----------------------------------------------------------------------------------------------------------------------------------------

