void setup(){
pinMode (2, INPUT_PULLUP);
pinMode (3, OUTPUT);
pinMode (3, OUTPUT);
}
void loop(){
if (digitalRead(2) == LOW){ // if button pin is low
digitalWrite (3, HIGH); // motor pin high, assume its driving a transistor to sink motor current
delay(3000); // wait 3 seconds
digitalWrite (4, HIGH); // solenoid pin high, assume its driving a transistor to sink solenoid current
delay(500); // wait 1/2 second
digitalWrite (3, LOW); // motor pin low
}
and solenoid never turns off after being turned on.
Don't forget resistor to limit current flow into base of transistor, and diode across motors & coil to protect the transistors from coil generated current - diode lets that current be dissipated back into the coils (motor & solenoid).
[/code]