View Full Version : Prop Educ Kit - TestIrDutyDistanceDetector.spin odd behavior

05-17-2010, 12:29 AM

When I run the Propeller Education Kit Labs ‘TestIrDutyDistanceDetector.spin’ program I get out very small values, on the order of 25, for the maximum value when I point the detector at a wall which is very far away. The manual gives sample values of over 100.

BUT, when I take the loop variable ‘duty’, which is in ‘IrDetector.spin’, and have it loop between, say 0 and 150, instead of 0 and 255, I get values greater than 100. It is a mystery as to how I can decrease the number of times the loop is gone through and the variable ‘dist’ can decrease in value. This variable ‘dist’ should increase as you increase the number of times the loop cycles through.

I have checked very carefully my setup, measuring the resistor values with a voltmeter, checking the wiring, etc.

I’d appreciate any feedback anyone may have as to why this mysterious behavior may be happening.

- Tim

05-17-2010, 10:18 AM

I haven't worked with this and am just about lights out tonight. A lot of guys are still not home from the meeting.
Sorry for the delay. If someone with the right answer doesn't respond in the morning, I'll try to take a look.


Post Edited (rjo_) : 5/18/2010 10:05:54 PM GMT

05-19-2010, 05:05 AM

Ok... everyone is back home and just about decompressed. Have you figured it out?
If not would someone with the right answer please come forward:)


05-19-2010, 08:16 AM
Rich & any others,

Still not clear what's going on.


- Tim

05-19-2010, 08:41 AM

I was planning to do this tonight... after I failed to keep my promise yesterday... I am tutoring my son through it and I got to the exact page... and the phone range.. we were late for our golf lesson... Now I'm home, thoroughly exhausted.

Many of the guys that could answer your post without blinking an eye have no idea what you are talking about and aren't going to look in the text to try to figure it out.

Post the code... as best you can... don't worry if it looks a little funky. And presto digito... the answer will come out like you waved a magic wand.

If that doesn't work... nothing is perfect... I absolutely ... positively ... and for sure will get to it tomorrow unless a rock falls on my head:)

I have an idea ... but I'm too tired to filter my own thinking right now and don't want to confuse you even further.



05-19-2010, 09:20 PM
TimZ said...
I’d appreciate any feedback anyone may have as to why this mysterious behavior may be happening.

I had problems on that exercise, too. In my case I (finally) realized that I was using an IR transistor instead of the IR diode. Swapping that out made a world of difference.

I assume you're using the "canned" code from Parallax, but if not certainly give it a try instead of any manually input code.

If you can attach a photo of your setup that would also be quite helpful ... indicate which lead is which on the parts, etc.