Timeout and overflow of arduino