byte potSignalPin = A0;
byte ledPin = 9;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int sensorValue = analogRead(potSignalPin);
int brightness = sensorValue / 4;
analogWrite(ledPin, brightness);
delay(250);
sensorValue = map(sensorValue, 500, 0, 0, 500);
analogWrite(9, sensorValue);
Serial.print("Pot signal = ");
Serial.println(sensorValue);
}