If you want some additional help read this.
http://decibel.ni.com/content/servle...20Tutorial.pdf
It talks about labview but it can really be applied to any language. A digital input, which the photoswitch is, returns either a true or false depending up what it is calibrated too. True if its the line, false if it isn't.