Doing multiple things at the same time

See Using millis() for timing. A beginners guide, Several things at the same time and the BlinkWithoutDelay example in the IDE