Sampling Incoming data from serial port

Hi! Thank you for your response. D you know how I could implement a variable such that it becomes the sampling rate here? Many thanks