If you must leave the roadway and drive on the shoulder in an emergency situation, you should:

If you must drive onto the shoulder to avoid a hazard, stay on it until you come to a stop; then signal, check your mirrors, and merge back into traffic. Avoid braking on the shoulder at speeds higher than about 20 mph. To help maintain control, always keep one set of wheels on the pavement, if possible.
DMV Writen Test