I just added a line tracker for my students to learn. It’s 1/8th of an inch from the floor. I tried calibrating it to find the thresholds, but no matter what I do, get sensor values of 269-273. I hooked up a second, and then a third, sensor to the cortex and held it near black paper and then white paper and even held it against something to block all light. Still the same readings with all the line tracker sensors.
That shouldn’t be happening. I don’t have good advice because it’s been over a year since our team experimented with the line sensors - but we most definitively saw a difference between light and dark in the sensor readings. However, I do remember having trouble at first getting the sensors to read. Perhaps post your code and the very helpful and knowledgeable people on here can help out.
Yeah something is not right. You should get values over 1000.
Anything blocking the sensor like a piece of tape? Are the wires frayed? Are they plugged in backwards?
It sounds like it might be a faulty sensor, but have you tried mounting it higher off the ground? Experiment with the height to see if that solves it. I’ve found that even from one sensor to another, the optimal height can vary a bit.
How are you reading the values? Do you have it configured as a line tracker and then watching the values in the debugger? Also try holding it up to bright sunlight, if for example the LED in the line tracker isn’t emitting infrared light, you should get some from sunlight resulting in a higher reading.
Yes, have it configured as a line tracker and watching debugger. No code, just watching the sensor values there. Tried all 3 sensors in the package. Brand new sensors so no fraying. One sensor is mounted on robot, the other two I’m trying handheld to see. All give the same limited calue range no matter how close or far from the object.
I’m going to try with sunlight and in a darkened room as you suggest.
They are plugged into the Analog sensor ports? (just checking, sometimes the most obvious things are the reason, or you may have a bum set of sensors)
a possibility is that the surfaces you are using have close to the same IR reflectiveness or you are reading the wrong port number, unconnected analog ports are around 255
I figured it out. In debug mode, the cortex was still attached to the computer. Of course, right? Lights flashing. Of course, right? But the switch on the cortex was off. As soon as I turned it on, values became much more reasonable.
Feeling sheepish and embarrassed.
It baffles me that the sensor values were fluctuating, just not in the range one would expect.
Thank you for your time and ideas!
Don’t feel bad.We’ve all done that and worse! There are about a hundred things you have to do right to get this stuff to work. And if you do just one thing wrong, it won’t. I find that perserverence along with a methodical, logical approach to problem solving is an important charateristic for my students and myself.