In this Arduino Tutorial Optical Sensor TCRT1000 was used for object detection. Objects should not be black. Black color absorbs infrared.
Download # Arduino Code (*.ino file)
Upload Arduino code directly to your Microcontroller from website
If you want to integrate Arduino IDE into your website (as above) sign up here: codebender