#define LED 10
#define LDR A0
int data;
void setup() {
// put your setup code here, to run once:
pinMode(LED, OUTPUT);
pinMode(LDR, INPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
data = analogRead(LDR);
Serial.print(" Data: ");
Serial.println(data);
data = map(data,0,1023,255,0);
analogWrite(LED,data);
delay(250);
}