A leadless pacemaker for pacing a heart of a human is provided, which can include any number of features. In some embodiments, the pacemaker can include a hermetic housing, a first electrode configured to fix the pacemaker to the heart, a second electrode exterior to the hermetic housing, a pulse generator disposed in the hermetic housing and configured to generate electrical pulses, the pulse generator being electrically connectable to the first and second electrodes, and a controller disposed in the hermetic housing and operatively connected to the pulse generator and a switching circuit to control the delivery of the electrical pulses between the first electrode or the second electrode and the metallic housing to stimulate the heart. In some embodiments, the pacemaker can include three electrodes, and can pace the heart with a first pair of electrodes and sense the heart with a second pair of electrodes.