analogPulse function added