A surgical stapler. The surgical stapler includes a drive system, an electric motor, a battery and a control system. The drive system includes a movable drive member. The electric motor is mechanically coupled to the drive system. The battery is electrically couplable to the electric motor. The control system is electrically connected to the electric motor and includes an accelerometer. The control system is configured to control a force applied to the drive system based on an acceleration of the movable drive member.