How to call the Ax states in a loop?

Have you set A1, A2 and A3 as OUTPUT with pinMode() ?

...R