modified arduino for timeout instead of delay