How to make an LED controlled sequence by Photoresistor+button

Basically I’m doing an easy project that I’m not quite sure on how to do. I know how to make light sequences, but I don’t know how to add in a photoresistor+ a pushbutton.

There are 3 conditions I need to make which I don’t know how.
The pushbutton is not pressed+roomlights on = a light sequence 1
The pushbutton is held down and room lights on = a light sequence 2
the room lights are off = light sequence 3

How exactly do I code the pushbutton and the photoresistor code together? I’ve looked at both tutorials, but I don’t know how to add the code together. Here is what I have at the moment. I’m on the 13 pin arduino thing. I have no clue how to add this stuff together. PLEASE any help! The pushbutton reads 1 or 0 on the serial communicator, but I don’t get how to put it together or code a photoresistor properly. Thanks!

int button;
int LED8;
int LED11;
int LED13;
int photoresistor




void setup()
{
  button=7;
  pinMode(button, INPUT);
  Serial.begin(9600);
}

void loop()
{
  Serial.print(digitalRead(button));
  
  delay(1000);
}

{
  photoresistor=A0;
  Serial.begin(9600);
}
void loop()
{
  Serial.println(analogRead(photoresistor));
}
void setup()
{
  photoresistor=A0;
  Serial.begin(9600);
}
void loop()
{
  Serial.println(analogRead(photoresistor));
}

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

You can only have one setup() and one loop() function.

When you declare a global variable, you should provide an initial value. Setting the initial value in setup() is syntactically valid but logically wrong.

Just printing the value read from a switch or sensor is useless. You need to store the value before you print it, so that you can use it, in if statements, etc.

Before writing ANY code, you should spell out your requirements, on paper, in as much detail as possible. “roomlights on” is not an implementable requirement. “light sensor reading is greater than 250” is. “The pushbutton is held down” is not an implementable requirement. “The switch remains in the LOW state for more than xxx milliseconds” is.

Start with trying to implement one of your requirements. Reading the switch state and storing the value would be a good start. Using an if statement to print “The switch is pressed” or “The switch is released” would be a good second step.

Then, it will become a lot more apparent how to implement the rest of the requirements.

Of course, it is necessary that the requirements be complete and non-conflicting. “The room lights are off” could be changed to “The light sensor reads less than 250”, which can be implemented, but says nothing about what to do if the switch is pressed while it is dark. What DO you want to see happen in that case? What about when the switch is not pressed? Of course, it is perfectly reasonable to say that the switch state doesn’t matter, when it is dark.