Respirator for ventilating a patient, comprising: a respiratory tube connector (29, 30) for connecting a respiratory tube (4, 5); an actuator (8, 10, 13) that is pneumatically connected to the respiratory tube connector (29, 30) for delivering air to a patient via the respiratory tube connector (29, 30); an oximeter connector for returning an oxygen saturation signal; a digital programmable controller that is electrically connected to said oximeter connector for delivering the oxygen saturation signal to said digital programmable controller, wherein the digital programmable controller is programmed • to calculate the oxygen saturation from the oxygen saturation signal, and • to determine whether the oxygen saturation falls below a lower limit and to increase the pressure at the end of exhalation and to increase the respiration rate (68, 69) characterized in that the respirator further comprises a valve and an oxygen connector for a gas or mixture of gases having more than 21 volume percent of oxygen, wherein an inlet of the valve is pneumatically connected to the oxygen connector, an outlet of the valve is pneumatically connected to the breathing respiratory tube connector and a control connector of the valve is electrically connected to the digital programmable controller, wherein the digital programmable controller further comprises a PID controller, which controls the valve so that the oxygen saturation differs as little as possible from a saturation setpoint between an upper limit and a lower limit. a respiratory tube connector (29, 30) for connecting a respiratory tube (4, 5); an actuator (8, 10, 13) that is pneumatically connected to the respiratory tube connector (29, 30) for delivering air to a patient via the respiratory tube connector (29, 30); an oximeter connector for returning an oxygen saturation signal; a digital programmable controller that is electrically connected to said oximeter connector for delivering the oxygen saturation signal to said digital programmable controller, wherein the digital programmable controller is programmed • to calculate the oxygen saturation from the oxygen saturation signal, and • to determine whether the oxygen saturation falls below a lower limit and to increase the pressure at the end of exhalation and to increase the respiration rate (68, 69) • to calculate the oxygen saturation from the oxygen saturation signal, and • to determine whether the oxygen saturation falls below a lower limit and to increase the pressure at the end of exhalation and to increase the respiration rate (68, 69) characterized in that the respirator further comprises a valve and an oxygen connector for a gas or mixture of gases having more than 21 volume percent of oxygen, wherein an inlet of the valve is pneumatically connected to the oxygen connector, an outlet of the valve is pneumatically connected to the breathing respiratory tube connector and a control connector of the valve is electrically connected to the digital programmable controller, wherein the digital programmable controller further comprises a PID controller, which controls the valve so that the oxygen saturation differs as little as possible from a saturation setpoint between an upper limit and a lower limit.