I'm currently using a photointerrupt which gives a high voltage when open, and low voltage when it is blocked. I'm using this schematic, with a OPB315 of TT Electronics:
All it needs in your code is an exclamation mark. sensorValue = digitalRead(sensorPin); // maybe what you have now sensorValue = !digitalRead(sensorPin); // logic result is the opposite now
Leo..