int potPin= A2;
int gPin=9;
int potVal;
float LEDVal;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(potPin, INPUT);
pinMode(gPin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
potVal=analogRead(potPin);
LEDVal =(255./1023.)*potVal;
analogWrite(gPin,LEDVal);
Serial.println(LEDVal);
}