A device for electronically controlling the flushing of a urinal, during which the presence of a user is detected and a flushing is triggered on departure of this user, this flushing including a first flushing of a duration T 1, a second flushing of a duration T 3, after a predetermined time T 2, if another user is not detected during this predetermined time T 2, including more especially a detector of the presence of a user which is connected to a sequential control microcontroller, this microcontroller being connected to an execution/stop solenoid valve of the first and second flushings, the microcontroller including a sequential execution program of the flushing process comprising at least, following the initialisation of an repetitive operating cycle of a long period of determined duration, a monitoring step for detection of the presence of a user (PU ?) of the urinal, on positive response (PU+) of the presence of a user of the latter: - a step of taking into account the continued presence (DU?) of the user during a determined duration (To); and, on positive response (DU?+) to the test of this step, - call of a step, during which a new test of the presence of the user (PU ?) is carried out and in the case of a negative response to this test, a short flushing is executed, constituting a first flushing by running successive steps of opening the solenoid valve for a determined duration (T 1), then a step of closure of the solenoid valve; - the said step of closure of the solenoid valve being followed by a determined delay step for a duration (T 2) during which a test for detection of a next user (DUs ?) is executed: - if a next user is detected (105+), then return to the step of taking into account continued presence, - if no new user has been detected (105-) during this determined duration T 2, then call of a step of execution of a long flushing of determined duration (T 3) constituting a second flushing, by opening then closing of the solenoid valve then, on detection (109+) of the presence of another user (PUa ?+), - call of a return step to the step of taking into account the continued presence of a user; if not, in the absence (109-) of detection of the presence of another user (PUa ?-), - call of a return step to the monitoring step of detection of the presence of a user, characterised in that the first flushing is a short flushing, the duration T 3 is greater than that of T 1, and after T 2 a third flushing is carried out of a duration T 5 when no person is detected during a predetermined long period T4, and the microcontroller is controlled according to the different durations T 1 to T 5. - a step of taking into account the continued presence (DU?) of the user during a determined duration (To); and, on positive response (DU?+) to the test of this step, - call of a step, during which a new test of the presence of the user (PU ?) is carried out and in the case of a negative response to this test, a short flushing is executed, constituting a first flushing by running successive steps of opening the solenoid valve for a determined duration (T 1), then a step of closure of the solenoid valve; - the said step of closure of the solenoid valve being followed by a determined delay step for a duration (T 2) during which a test for detection of a next user (DUs ?) is executed: - if a next user is detected (105+), then return to the step of taking into account continued presence, - if no new user has been detected (105-) during this determined duration T 2, then call of a step of execution of a long flushing of determined duration (T 3) constituting a second flushing, by opening then closing of the solenoid valve then, on detection (109+) of the presence of another user (PUa ?+), - call of a return step to the step of taking into account the continued presence of a user; if not, in the absence (109-) of detection of the presence of another user (PUa ?-), - call of a return step to the monitoring step of detection of the presence of a user,