modified to print at the point of turning on and off leds
check process time by print in while loop