Playing with light sensors out of an old mouse
Thomas Fletcher
Posts: 91
I ripped out two what I believe to be light sensors and infrared leds from an old computer mouse. I have used the light sensor from parallax but this one only has two pins. I tried hooking it to a propeller pin as an input and the other pin to ground, but the pin keeps alternating 1 to 0 no matter its light exposure.
Tried this code with nothing attached to the pin and have tried several pins. Each time the variable lighton just keeps alternating 1 to 0.
I am wondering if I have blown something or if I am not understanding the code.
dira[noparse][[/noparse]24]~ repeat lighton := ina[noparse][[/noparse]24]
Tried this code with nothing attached to the pin and have tried several pins. Each time the variable lighton just keeps alternating 1 to 0.
I am wondering if I have blown something or if I am not understanding the code.
Comments
Most mice use photodetectors that require a pullup resistor, and they will conduct when exposed, pulling the signal to ground (1=no light, 0 = light).· They are polarity sensitive, but probably won't be damaged if hooked up backwards.· However, they may be burned out if you powered them without the resistor - likewise the led's.
Scroll down a bit to the schematic on this page for an idea.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I haven't even tried the emitter yet, still not sure why it has three pins.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
I believe the 3 pin one is the detectorS, you need 2 per axis so you know which direction you are moving.