Help....
Trying to build two motion detecting triggers to push a electrical button (350mil), then they need to delay one for 30000mil (30 seconds) and one for 60000mil (60 seconds), then wait for the next trigger.
I can get one to work at a time but not both,
one will trigger after the 30 second delay or sometimes after code changes it will trigger for 30 seconds. this is my first time trying to code and I'm running out of time. this project is for Halloween
binky
Edit: I forgot to add my sketch:
void setup() {
int sensor = 8;
int sensor1 = 12;
int pinmode = 3;
int pinmode1 = 5;
pinMode(sensor,INPUT);
pinMode(sensor1,INPUT);
pinMode(3,OUTPUT);
pinMode(5,OUTPUT);
}
void loop()
{
{int sensor = 8;
if (digitalRead(sensor) == HIGH) digitalWrite(3,HIGH);
delay(350);
int sensor1 = 12;
if (digitalRead(sensor1) == HIGH) digitalWrite(5,HIGH);
delay(350);}
While it gives the basic idea of not using the delay function, but instead checking when the next thing to happen should occur, I suspect a lot of people still have conceptual blocks with it, and it would have been helpful if the example had 2 or more things going on at the same time with different timeouts
MichaelMeissner:
The usual place to look at for multiple delays is the example program blink without delay that is in your Arduino release: http://arduino.cc/en/Tutorial/BlinkWithoutDelay.
Michael
This gives a example of one input one output, I need two independent inputs and outputs.