const int sensorPin = A0; 
const float GAMMA = 0.7;
const float RL10 = 50;
const int ledCount = 10; 


int ledPins[] = {
  2, 3, 4, 5, 6, 7, 8, 9, 10, 11
};

void setup() {
 
  for (int thisLed = 0; thisLed < ledCount; thisLed++) {
    pinMode(ledPins[thisLed], OUTPUT);
  }
}

void loop() {
  
  int sensorReading = analogRead(sensorPin);


  float voltage = sensorReading / 1024. * 5;
  float resistance = 2000 * voltage / (1 - voltage / 5);
  float lux = pow(RL10 * 1e3 * pow(10, GAMMA) / resistance, (1 / GAMMA));


  int ledLevel = map(lux, 0, 1023, 0, ledCount);

  for (int thisLed = 0; thisLed < ledCount; thisLed++) {
    
    if (thisLed < ledLevel) {
      
      digitalWrite(ledPins[thisLed], HIGH);
    } else {
     
      digitalWrite(ledPins[thisLed], LOW);
    }
  }
}