input analog array > output digital array

  for (int i=0; i < 5; i++) {
    if (anIn[i] < 512)

You can pretty much be guaranteed that A0, A1, A2, A3, A4 will always be less than 512.
Did you mean to record the analogue readings you took, or was that just an approximate surrogate for "delayMicroseconds (500)"?