Photo interrupter outputting erratic analog signal

You definitely need to use a pinMode INPUT_PULLUP and digitalRead to sense it.