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));
}