control pins independently without delay()

Hey Mike, thanks for the code. I loaded it up and it seems to only pull the pin HIGH when the button is HIGH.

here is a very simple thing I tried, but it did not work:

const int buttonPin = 2;//button attached to pin 2
int buttonState = 0;//variable to store the state of button

                      
int event1 = 13;//ssr to be connected to pin 9 for lights
long eventtime1 = 0;//clock value to be stored at the time milli() is called


void setup() {

pinMode(buttonPin, INPUT);

pinMode(event1, OUTPUT);


}

void loop(){
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);

// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
   if (buttonState == HIGH) {  //when button is pushed...
     
      eventtime1 + 500 == millis(); //wait 1/2 a second...

digitalWrite(event1, HIGH);//turn on pin 13 
if(eventtime1 > 3000){  //after 2 1/2 seconds...
  digitalWrite(event1, LOW);//turn off pin 13 

} 
   }
      }

here is an awkward "drawing" of what I am attempting to achieve:

this taking place over a 5 minute period, and when a button is pushed...

Pin
1 ---------||||||||||||---------

2 -----||||||||||||||-----------

3 ---||||||||||||||||||||||||---

4 ------------------||||||||----

5 --------------|||||||||||||---

---- = off(LOW)
|||| = on(HIGH)

thanks