const int led = 3;
const int potentiometer = A0;
double sensorValue = 0.0;
float i;
void setup() {
// put your setup code here, to run once:
pinMode(potentiometer, INPUT);
pinMode(led, OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
sensorValue = analogRead(potentiometer);
i = sensorValue/1023*255;
Serial.print("Anamog: ");
Serial.print(sensorValue);
Serial.print(", Brightness: ");
Serial.println(i);
analogWrite(led, i);
delay(100);
}