I am trying to catch how fast a number is being rotated.
I have a program where the counter starts at 0.
Every time the user clicks the button "add 1". It increments the counter by 1.
The counter maxes at 255. after 255 it goes back to 0.
Now I want to display how many seconds it took from 0 to increment to max and back to 0. Time for the complete revolution. Its gonna differ on how fast the user has clicked the button.
What I need to know is how to use a timer for this? The program is complete just the timer between the complete revolution of the numbers I need to code.
I'm using
#include <time.h> //* clock_t, clock, CLOCKS_PER_SEC
Please advice. Thank you.
int counter;
counter = pkt[0];
cout << endl;
cout << counter << endl;
if(counter == 1)
{
cout << "revolution" << endl;
}