What is the purpose of camshaft?

Explanation:

Camshaft operates inlet and exhaust valves.