How do I turn a number of pins to high and then off after 5 seconds based on a serial command
Have you tried the delay() function? Try putting this in the loop() function for pin 3.

digitalWrite(3, HIGH);
delay(1000); // time in milliseconds as parameter
digitalWrite(3, LOW);