control rpm of a motor

Thank you. I Use an Interrupt to count the general cycles with the function ( 0, count, RISING),

i would like use something like this:
void pulses()
{
for (int z = 0; z<10;z++)
{
pulses += digitalRead(lightsensor)
and then
timer start();
pulses();
timer stop();