I tried to find the answer to my question in several other threads, but i couldn´t find one fitting.
I have a light barrier consisting of 2 photo-transistors. I want to detect the peaks of these barriers with the android headphone jack. I need to know the time between these. I´ve got a amplifier cicuit for it already, so the peaks are pretty steep now.
My approach is to use the AudioRecord class, scan through the buffer, find the rising edge, start a timer and stop it after the second peak. That´s kinda working already, but only for times around 100ms. What I need is to measure precisely in the 1-10ms region. The peak is maybe around 0.1ms wide. I call the peak detect funktion every 0.01ms, but i noticed, that it hast around 3000 values in its buffer to scan through this. I think that it takes too long to scan through these.
Am I stuck on the wrong approach? Is there a more easy way to do this? It just hast to be fast ;-).
Thank You in Advance!