A driving tool having first and second linear motors, a head assembly, a nosepiece and a driver. The first linear motor forms an air compressor and includes a scotch yoke mechanism for translating a first piston in a first cylinder. The scotch yoke mechanism includes a crank arm, a crank arm roller, which is coupled to the crank arm, and a connecting rod having a roller slot into which the crank arm roller is received. At least a portion of the roller slot is configured to vary an output rate at which the connecting rod translates along a translation axis relative to an input rate at which the crank arm roller moves in a direction that is parallel to the translation axis.