A surgical stapler. The surgical stapler includes a drive system, a handle assembly, an electric motor, a battery and a control system. The drive system includes a movable drive member. The handle assembly includes a frame configured to support the 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 a sensor positioned on the frame. The control system is configured to control the electric motor based on a force applied to the frame by the movable drive member.