I came across an interesting article yesterday on Hack-A-Day about using a LED as a Photo Sensor and cheap communictaion device. This is achieved by using some physical properties of the LED for both Transmit and Receive. The article also links to a cool video clip demonstrating this. Original Article can be found here http://www.hackaday.com/entry/1234000873073550/
Anyway this sparked my interest and I soon had a PICAXE-08M hooked up to test if it-in fact it works (I also made sure that the date was not 1st April LOL). After about an hour I had it working, this code requires 3 LEDs, One acts as the Light Source and is always on (not really necessary, you can use anything as a light source, the brighter the better), the Second LED acts as the Sensor and is connected to two outputs along with the current limiting resistor, this is really the heart of the concept. The third LED is a status Indicator and gets switched on and off depending on the reading of the LED Sensor.
This idea, as simple as it is, makes for some interesting sensor ideas.
Here’s the PICAXE code – LEDSwitch.zip