FSR input

I'd be really grateful if someone could point me in the direction of an example of how to code the following:

I have a FSR attached to an analogue pin, if a user presses the sensor harder than a certain level continuously for a duration of 3 seconds I then want to print to serial. if a user stops pressing the sensor before the 3 second duration is up nothing happens.

Thanks for any help you can give.

I have a FSR attached to an analogue pin

And, some code, presumably.

if a user presses the sensor harder than a certain level continuously for a duration of 3 seconds I then want to print to serial. if a user stops pressing the sensor before the 3 second duration is up nothing happens.

You need to note the time when the value exceeds the threshold.

You need to note the time when the value drops below the threshold.

Separately, you need to see if the value is above the threshold, the start time has been set, the end time has not been sent, and the specified interval has been exceeded. If all 4 are true, send a message.

You'll need to determine appropriate times to clear the start and end times, so that only one message gets sent. Like, as soon as you send the message.

You'll also need to clear the end time when the start time is set.