int ledPin =8;
int ledPin2 =9;
int potentiometerPin = A0;

int val=0;

void setup()
{
  Serial.begin(115200);
  pinMode (ledPin, OUTPUT);
  pinMode (ledPin2, OUTPUT);  
}

void loop()
{
  int potValue = potentiometerValue();
  int fadeValue = map(potValue, 0, 1023, 0, 255);
  int fadeValue2 = map(potValue, 1023, 0, 0, 255);
  
  analogWrite(ledPin, fadeValue);
  analogWrite(ledPin2, fadeValue2);

  Serial.print("Potentio Value ");
  Serial.println(potValue);
  delay(30);
}

int potentiometerValue ()
{
  int val=analogRead(potentiometerPin);
  return val;
}