Hello Giulietta,
I checked your code one more time, and I think below line is the problem.
user_delay_ms(meas_period + delay*1000); /* Delay till the measurement is ready */
Please just use
user_delay_ms(meas_period); /* Delay till the measurement is ready */
For test, you can test with 300ms delay something like that.
I attached my example for reference.
Thanks,
The code now works! thank you very much!