How to make 0.5seconds wait time between function calls?