Just for laughs, you could increase the LED current when you detect "white" and decrease it when you detect "black". I've also done sensors where I drove the LED from the phototransistor so as to get a constant current in the transistor, like 1mA, and used the LED drive voltage to determine the state of the system. This also detects failed components since you can't close the servo loop if the LED or phototransistor fail. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist