Hi, I’m new to Arduino. I need to set a threshold value for my program. Actually have result from sensor in the form of sign wave. And I need to find the max and min of the sin wave. Then set a threshold by (min+max)/2. The problem is, I need to get first threshold from 1st min and max, then use this threshold as a reference for the next part of the wave. Then find another threshold and so on. ie… get threshold from previous data for the coming data.
I have got values from sensor. I did smoothing and find average, then also find max and min. But have so many values for min and max as attached. How to find which one to use? And then how to set threshold? Please help.
Thanks in advance.