A setup like that shown in Image 1 is e.g. typical for a steam engine. It is surprisingly difficult to animate this setup, because one has to translate a rotating movement (of the Flywheel) to a horizontal movement (of the Piston). This alone wouldn't be too difficult, but the Rod has to stay attached to the Piston. The shown setup uses three empties and two armatures, each with two bones.

The horizontal direction is the Y-direction, if this is different in your model you have to exchange Y with your horizontal direction.

Use Ctrl-A->Apply scale and rotation on all mechanical parts in object mode.

This will spare you from bad surprises if you rotate the flywheel afterwards.

We need an object which follows the rotation of the flywheel. We use an Empty, which is parented to a Vertex.

Image 2:Make vertex parent of an Empty.

Change to edit mode of the flywheel. Select a Vertex in the middle of the crank.

Move the cursor to the Vertex (Shift-S->Cursor->Selection).

Change to object mode and insert an Empty (ERotation).

Change back to edit mode of the flywheel. The vertex is probably already selected, now select with Ctrl-RMB the Empty and press Ctrl-P->Make vertex parent (Image 2).

Image 3: The positions of the three Emptys.

We need two more Emptys:

Place the second Empty (EGelenk) in the center of the joint between Rod and Piston.

Place the third Empty (ESteuerung) near to the joint.

Now select at first EGelenk, than Shift-RMBESteuerung and parent EGelenk to ESteuerung with Ctrl-P.

We're going to insert two armatures, each with two bones. The first armature, helps translate the rotation to a horizontal movement. The second armature drives the Piston and the Rod. The cursor should be positioned at the Empty ERotation (like in Image 3), else set it there.

Add an armature (AHelfer). The root of the first bone (BHelfer1) has the same position as ERotation, the tip has to be positioned to the Empty EGelenk (select Empty first, Cursor->Selection, than select bonetip, Selection->Cursor).

Extrude another small bone (BHelfer2) in horizontal direction.

BHelfer2 is automatically Child of BHelfer1. The second armature that is driving the movement of piston and rod will be inserted in the opposite direction, i.e. from right to left in our example.

Position the cursor on the piston.

Add an armature (AGestaenge).

Move the tip of the first bone (BKolben) to EGelenk.

Extrude the first bone and place the tip of the second bone (BPleuelstange) to ERotation.

Connecting the two bones will ensure that the rod cannot disconnect from the piston.

Image 4: The alignment of the two armatures.

Now we're going to add the "logic".

Image 5: The constraint settings for BHelfer1.

Add a Copy Location constraint to BHelfer1 which points to ERotation. To do this change to the pose mode of the armature AHelfer and select BHelfer1. In the Constraints panel click Add Constraint->Copy Location and type ERotation into the Ob: field.

BHelfer1 needs a second constraint: Track To to EGelenk (Image 5).

Now the root of the bone BHelfer1 follows the rotation of the Flywheel. It's tip follows the joint, but with slight deviations upwards and downwards. The position of BHelfer2 governs the horizontal position of the Piston. We just have to "extract" the horizontal position, for that we're going to use a CopyLocation constraint, but only in Y-direction. There is no offset for a copy location constraint - else we could have done with one empty less.

Image 6: Constraints of ESteuerung.

ESteuerung gets a CopyLocation constraint in Y-direction to AHelfer->BHelfer2. You have to inactivate X and Z (Image 6).