Your baseline function doesn't do what you say it does. It only samples four times. baseline[4] of the array will be garbage when it is passed to the lecturaMedia function.
Use this:
for (int i=0;i<5;i++) {
Pete
Your baseline function doesn't do what you say it does. It only samples four times. baseline[4] of the array will be garbage when it is passed to the lecturaMedia function.
Use this:
for (int i=0;i<5;i++) {
Pete