tags:

views:

234

answers:

2

Im using a handyboard and interactive c software and the task is to find the rpm of a lego motor in real time using an Infrared "Break Beam" Sensor on the wheel. I was thinking about finding the time interval between the beam being broken and then from there calculating the rpm but i cant figure out exactly how to do that. Any help would be much appreciated thanks.

A: 

Do mean something like this: http://www.cplusplus.com/reference/clibrary/ctime/

I believe there a better resolution ones out there (as Neil is implying), but this is the simplest.

Glenn
A: 

If you have access to Win32 then you can use QueryPerformanceFrequency to calculate the time of the interval. It's also often being used to determine the amount of frames per seconds in games, so it's very precise.

Chaoz