The camshaft controls the opening and closing of the intake and exhaust valves in the cylinder head.