Stop on black line

The maximum value from analogRead() is 1023 so it will ALWAYS be less than 1050.