Potresti usare un timer! Ricorda che la proprietà interval è impostata in millesimi di secondo!