Difficulty with OR statements powering a LED

Hey
So I've really been trying to get this darn thing to work! The goal is to get the LED to turn on when the photo-resistor registers a change in light or an input from a switch. Right now everything works perfectly fine except for

// Door Closing
if (photocellReading < 378 || manualDownReading == 0) {
digitalWrite (6, HIGH);
}

More specifically the manualDownReading part. If the light is off (because the photocell registers light > 400) triggering the manual Down Switch should turn the light on, but it doesn't. I really have no idea why! Thanks for the help!

The attachment is a photo of my schematic.

The LED is a substitute for a motor I just find it easier to test because it's visible.

Just FYI I've noticed that when i toggle the switch the LED does blink, very faintly, every 10 seconds or so. Could the delays have something to do with it?

I got rid of all the delays on the serial print and the led started to blink faster within a second.

int photocell = 0;

int upDetect = 11;
int downDetect = 9;

int manualUp = 10;
int manualDown = 3;

int upswitchReading;
int downswitchReading;
int photocellReading;
int manualUpReading;
int manualDownReading;

void setup(void) {
  pinMode (upDetect, INPUT_PULLUP);
  pinMode (downDetect, INPUT_PULLUP);

  pinMode (manualDown, INPUT_PULLUP);
  pinMode (manualUp, INPUT_PULLUP);
  pinMode (6, OUTPUT);

  Serial.begin(9600);
  delay(1000);
}

void loop(void) {
  Serial.println("Up Switch Reading = ");
  upswitchReading = digitalRead(upDetect);
  Serial.println(upswitchReading, DEC);
  delay(1000);

  Serial.println("Down Switch Reading = ");
  downswitchReading = digitalRead(downDetect);
  Serial.println(downswitchReading, DEC);
  delay(1000);

  Serial.println("Manual Down Switch = ");
  manualDownReading = digitalRead(manualDown);
  Serial.println(manualDownReading, DEC);
  delay(1000);

  Serial.println("Manual UP Switch = ");
  manualUpReading = digitalRead(manualUp);
  Serial.println(manualUpReading, DEC);
  delay(1000);

  Serial.println("  Photocell reading = ");
  photocellReading = analogRead(photocell);
  Serial.println(photocellReading);
  delay(1000);


  // Door Closing
  if (photocellReading < 378 || manualDownReading == 0) {
    digitalWrite (6, HIGH);
  }
  
  // Door Opening
  if (photocellReading > 400 || manualUpReading == 0) {
    digitalWrite (6, LOW);
  }

}

First, do you have a current limit resistor ( 220 to 330 Ohms) in series with the LED? Drawing don't show one.

I don't have one right now, but I just added one. Is that to help with with the life of the LED or....

It's to keep the LED AND the Arduino's output pin from being destroyed by too much current. Another thing I see is A0 is connected to GND, should be connected to the junction of LDR and 10k resistor.

Ok cool thanks for saving my Arduino! I still have no idea what's going on with the manualDownReading. I suspect that it might be a de-bouncing thing but if it was then both manualDown and manualUp would have the same problem. So ¯_(ツ)_/¯

I'm sorry I don't fully understand what you want me to do.

If the photocell reads anything above 400 it turns the LED off. The manualDownReading has almost no effect on the LED (it occasionally blinks).

If I go from a photocell reading below 378 and shine a light on it the LED turns off.

If I go from a photocell reading above 400 and take away the light the LED turns on.

If the photocell has a reading below 378 I can turn the LED off using the manualUpReading.

OMG so they're cancelling each other out!

So would I have to make individual if statements of each scenario? or How can I fix this?

Thank you so much! Could you help me understand your code a little better? I'm not to familiar with Boolean stuff.

In your code what does the whatToOutput represent?

Just to make sure I understand what to output means the result. In this case it would be powering the LED.
Right?

So in this context what would the whatToOutput value be?

So you could write something like

if (what to output == FALSE){
digitalWrite (6,HIGH);
}

Ok I'll give it a shot. Thanks!