I think I found a way to speed up the process. Revised Visio file is attached.
I fixed the execution speed to 10 ms. There are three speed modes - Normal (4 Samples per second), Fast (2 Samples per second) and x2 Fast (1 Sample per second).
For a duration of 100 seconds in Normal mode, code will collect 400 samples with 10 ms/sample speed so whole process will take 4 seconds. This will take 2 seconds in Fast mode and 1 second in x2 Fast Mode but resolution will get worse.
