Time isn't working

posi = alr;

Try to reset posi =0 some where. I think it can be done at the end of programa().