First off, it is always a good idea to post any code using code tags so that people can read your code without having to download it. See post #7 of this thread for details.
WRT your distance sensor: assuming that the wiring is correct (it would be helpful to have a schematic) then the problem could either be with the arduino 'seeing' the wall, or with the arduino reacting to having seen the wall. If I were you I would add some simple way of seeing if the arduino have 'seen' an object in front of it- say turning on an LED. That will help you start to narrow down where the problem is.