06 IR sensor + RGB leds & Floating Duck experiment
I set three ranges of distance for each led.http://vimeo.com/moogaloop.swf?clip_id=2060055&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1
IR sensor + RGB led from Hsiang Ju Hung on Vimeo.
Here is the code: Download IR_RGB
.
And I did a test for floating duck.
I made a plastic base installed IR sensor for duck. And put it into a container (6"*6"*6").
Then kept adding water into it.
Here is the height of the water V.S. analogRead
1 inch : -255
2 inch : -65
3 inch : -170
4 inch : -240
Yeah~ it works in water!!! The voltage changes with the height.
But even I tried many times to modify the proper range for each led, I still cannot make leds switch with the value. Um… maybe it is because it is always negative value and it changes non-linearly….. have no idea yet.
UPDATE: I tried to do it without water in the same distance but still failed. It only turned on one led. I found that it might because it is below 10 cm which is out of Sharp sensor range(10-80cm). So I think I need to measure the proper height of water in tub to see if the sensor is suitable for it first. 10/28


Reply