Don't use pin 13 for input. The built-in LED and an internal resistor muck things up. This page has instructions on what you should do if you really need to use it for input. It says: "NOTE: Digital pin 13 is harder to use as a digital input than the other digital pins because it has an LED and resistor attached to it that's soldered to the board on most boards. If you enable its internal 20k pull-up resistor, it will hang at around 1.7V instead of the expected 5V because the onboard LED and series resistor pull the voltage level down, meaning it always returns LOW. If you must use pin 13 as a digital input, set its pinMode() to INPUT and use an external pull down resistor."
The ultrasonic sensors have, on rare projects, been known to freeze up after a while. The symptoms are that they read values for some period of time, then start just reading 0 all the time until the program is rerun. This is repairable by resetting the echo pin after every read. Here is some sample code to do so:
int distance = sonar.ping_cm(); pinMode(echoPin, OUTPUT); digitalWrite(echoPin, LOW); pinMode(echoPin, INPUT);This is described on an mbed.com blog posting, which in turn refers to an embedded answer in the Arduino forums.
The break-beam sensors that we have require a fairly substantial item to break the beam. Plan on using something large and thick; otherwise, the IR signal seems to slip around or through the item and the beam does not get broken.