const int ldr = A0;
const int led = 10;
void setup() {
// put your setup code here, to run once:
pinMode(ldr, INPUT);
pinMode(led, OUTPUT);
Serial.begin(115200);
}
void loop() {
// put your main code here, to run repeatedly:
int inputValue = analogRead(ldr);
int outputValue = map(inputValue, 0, 1023, 0, 255);
Serial.print(inputValue);
Serial.print(", ");
Serial.println(outputValue);
analogWrite(led, outputValue);
delay(10);
}