The crankshaft is connected to the pistons via a connecting rod. As the piston moves up and down in the cylinder it rotates the crankshaft and converts the straight line motion into rotary motion.
The valvetrain consists of valves, rocker arms, pushrods, lifters, and the cam shaft. The valvetrain's only job is that of a traffic cop. It lets air and fuel in and out of the engine at the proper time. The timing is controlled by the camshaft which is synchronized to the crankshaft by a chain or belt.