Controlling frequency of sensor reading


I have a number of sensors that I am using for a robot build. I am able to read/write to the sensors using the serial (both UART and I2C), however, I was wondering if there is a way to control the frequency of reading the sensors.

For example, I have a CMPS10 module, but I don't need to read its values every time it goes through the main loop. I have coded in delays, however I feel that there must be a more correct method to control this. An example I would hope to achieve would be 2 readings per second, so sample every 500ms.

Thank you in advance for any help.

Check out the blink without delay example

Thank you!