Artificial pacemaker for treatment of Adams-Stokes syndrome and slow heart rate