The disclosure relates to a device including a circuit for adjusting the energy of the stimulation pulses, independently controlling the pulse width and the voltage of each stimulation pulse. An iterative search algorithm for determining the optimum energy includes changing both the pulse width and voltage at each new pulse delivered, by setting a high energy value and a low energy value, and delivering a stimulation pulse with the low energy value. A capture test is then carried out. In the presence of a capture, a current iteration is complete and a new iteration is done with the current low energy as a new high energy value. In the absence of capture, the algorithm is terminated with selection of the last energy value that produced the capture as the value of optimum energy.