int photoPin = A0;
float fixedResistor = 10000.0;
int dt = 1000;
void setup() {
Serial.begin(9600);
pinMode(photoPin, INPUT);
}
void loop() {
int photoValue = analogRead(photoPin);
// Conversion of analog Value which is between 0 to 1023 into analog voltage
float photoResistance = (fixedResistor * (1023.0 - photoValue)) / photoValue;
float brightnessLevel = (photoValue/1023.0) * 100;
Serial.print("Photo Resistor Value = ");
Serial.println(photoValue);
Serial.print(",");
Serial.print("Resistance = ");
Serial.print(photoResistance);
Serial.println(", Brightness Level = ");
Serial.println(brightnessLevel);
delay(dt);
}