OK BBarney

I should point out that the code is mine but the original concept is'nt so i can't take any credit for the idea, also it is a new concept to me also so im at the learning stage.
i'll post updates on progress, there is some potential here for applications, not everyone has got photodiodes in their bit boxes but just about everyone has an led kicking around somewhere, besides i like the idea of using a device as emiter and sensor in one package