A ventilator, or a breathing assistance apparatus, is disclosed to ventilate a patient who may have breathing difficulties, said device comprising a valve comprising at least three ports, said three ports comprising one inlet port, a first outlet port and a second outlet port, the inlet port adapted for connection to the patient via a primary duct configured for flow of a gas, at least one peak inspiratory pressure (PIP) control duct adapted for connection to the first outlet port of the valve, at least one positive end-expiratory pressure (PEEP) control duct adapted for connection to the second outlet port of the valve, and at least one controller communicably connected to the valve to control rate of cycling of the valve, thereby controlling number of breaths per minute, and to control the duration of peak inspiratory pressure, also known as inspiratory time.