Added Test code for controlled loop with sample rate