const int photoResistorPin = A0; // Analog pin where the voltage divider is connected
const int fixedResistorValue = 10000; // Value of the fixed resistor in ohms (10k ohms in this example)

void setup() {
  Serial.begin(9600); // Initialize serial communication
}

void loop() {
  int sensorValue = analogRead(photoResistorPin); // Read the value from the analog pin
  float voltage = sensorValue * (5.0 / 1023.0); // Convert the ADC value to voltage

  // Calculate the resistance of the photoresistor using the voltage divider
  float photoResistorValue = (fixedResistorValue * (5.0 - voltage)) / voltage;

  Serial.print("Sensor Value: ");
  Serial.print(sensorValue);
  Serial.print(" - Voltage: ");
  Serial.print(voltage);
  Serial.print("V - Photoresistor Value: ");
  Serial.print(photoResistorValue);
  Serial.println(" ohms");

  delay(1000); // Wait 1 second before the next reading
}