What do piston do in a car?

A piston draws air into the cylinder through an intake port. The intake valve closes and the air/fuel mixture compresses as the piston moves back up. Once the mixture is fully compressed, it is ignited and explodes forcing the piston down (this is known as the power stroke). An exhaust valve opens and the burned gases are expelled out of the cylinder as the piston moves back up to complete its cycle.

This is different from a heart valve. A heart valve would be similar to a bicycle tire pump though. As the piston draws air into the air chamber,the valve opens to allow the air to fill the chamber. the piston then, changes direction and pushes that valve closed and opens another valve to allow the air to be pushed out the air line. The difference is in the valves. a bicycle pump uses check valves. Check valves allow flow in one direction.