user47092: Each LDR is connected to one LED because I am doing a parking lot model. I have tried but with no luck. Help!
    int ledPin = 11;
int sensorInput = A0;

boolean ledIsOn = false;

void setup() {
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  int lightLevel = analogRead(A0);

  if (ledIsOn) {
    if (lightLevel > 600) {
      ledIsOn = false;
    }
  } else {
    if (lightLevel < 400) {
      ledIsOn = true;
    }
  }

  digitalWrite(ledPin, ledIsOn);

  Serial.println(lightLevel);
}

*this is the code for one LED to one LDR Sensor but I cannot make the 6 led to 6 ldr
and I did this code for 6 LDR
#define pin_size 6
const int pin[pin_size] = { A0, A1, A2, A3, A4, A5};

void setup() {

  Serial.begin(9600);

}

void loop() {
  for (int i = 0 ; i < pin_size; i++) {
    Serial.print(analogRead(pin[i]));
    Serial.print(" - ");
    Serial.print(i);
    Serial.print("  |  ");

  }
  Serial.print("\n");
  delay(1000);

}


user2881: You need to convert all the regular variables to arrays. The loop through each index and run the the same as before for each index.
const int pin_size 6
int ledPins[] = {3, 4, 5, 6, 7, 8};
int sensorPins[] = {A0, A1, A2, A3, A4, A5};
boolean ledIsOn[] = {false, false, false, false, false, false};

void setup() {
  for (int i = 0 ; i < pin_size; i++) {
    pinMode(ledPins[i], OUTPUT);
  }
  Serial.begin(9600);
}

void loop() {
  for (int i = 0 ; i < pin_size; i++) {
    int lightLevel = analogRead(sensorPins[i]);

    if (ledIsOn[i]) {
      if (lightLevel > 600) {
        ledIsOn[i] = false;
      }
    } else {
      if (lightLevel < 400) {
        ledIsOn[i] = true;
      }
    }

    digitalWrite(ledPins[i], ledIsOn[i]);

    Serial.println(lightLevel);
  }
}


47092: <p>Each LDR is connected to one LED because I am doing a parking lot model. I have tried but with no luck. Help!</p>

<pre><code>    int ledPin = 11;
int sensorInput = A0;

boolean ledIsOn = false;

void setup() {
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  int lightLevel = analogRead(A0);

  if (ledIsOn) {
    if (lightLevel &gt; 600) {
      ledIsOn = false;
    }
  } else {
    if (lightLevel &lt; 400) {
      ledIsOn = true;
    }
  }

  digitalWrite(ledPin, ledIsOn);

  Serial.println(lightLevel);
}
</code></pre>

<p>*this is the code for one LED to one LDR Sensor but I cannot make the 6 led to 6 ldr</p>

<p>and I did this code for 6 LDR</p>

<pre><code>#define pin_size 6
const int pin[pin_size] = { A0, A1, A2, A3, A4, A5};

void setup() {

  Serial.begin(9600);

}

void loop() {
  for (int i = 0 ; i &lt; pin_size; i++) {
    Serial.print(analogRead(pin[i]));
    Serial.print(" - ");
    Serial.print(i);
    Serial.print("  |  ");

  }
  Serial.print("\n");
  delay(1000);

}
</code></pre>
 2881: <p>You need to convert all the regular variables to arrays. The loop through each index and run the the same as before for each index.</p>

<pre><code>const int pin_size 6
int ledPins[] = {3, 4, 5, 6, 7, 8};
int sensorPins[] = {A0, A1, A2, A3, A4, A5};
boolean ledIsOn[] = {false, false, false, false, false, false};

void setup() {
  for (int i = 0 ; i &lt; pin_size; i++) {
    pinMode(ledPins[i], OUTPUT);
  }
  Serial.begin(9600);
}

void loop() {
  for (int i = 0 ; i &lt; pin_size; i++) {
    int lightLevel = analogRead(sensorPins[i]);

    if (ledIsOn[i]) {
      if (lightLevel &gt; 600) {
        ledIsOn[i] = false;
      }
    } else {
      if (lightLevel &lt; 400) {
        ledIsOn[i] = true;
      }
    }

    digitalWrite(ledPins[i], ledIsOn[i]);

    Serial.println(lightLevel);
  }
}
</code></pre>
