ADXL377

I was thinking about taking samples until a peak is detected.
After that the peak value could be sent to the serial monitor.
That requires more programming and comparing the values.
Can you do that ?