A crankshaft is a part in a reciprocating engine, used to convert between reciprocating motion from the pistons and rotational motion from the rest of the vehicle. The crankshaft is connected to the pistons by "crankpins" which have an offset axis allowing this conversion of motion to be accomplished, and can be viewed in Figure 1. Since the common four-stroke cycle (Figure 2) of the reciprocating engine isn't continuous, the crankshaft is often connected to a flywheel which is used to store rotational energy in order to reduce the pulsation or choppiness of the pistons.
Figure 1: The crankshaft (red) converts reciprocating motion from the pistons (grey) which is often combined with a flywheel (black).
Figure 2: 4-stroke internal combustion engine. 1:fuel injection, 2:ignition, 3:expansion(work is done), 4:exhaust.