Need help with writing program

The plan here is to use a 1 switch, 2 relays for a solenoid plunger, and 2 electric motors. Use external power supply for motors and solenoid. See attachment for diagram.

I am looking to write a program to do the following:

If button is depressed
Turn motors on.
Wait 3 seconds.
Activate solenoid.
Wait 0.5 seconds.
Turn 2 motors off.

I do not have any experience programming with arduino. I am just starting to read about it so I thought I would start here. If someone could help me with the the program and direct which pins to use and how that would help me out a lot! Thanks!


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).