How to Calibrate Line Follower in Vexcode?

Pretty much the title… I couldn’t find any documentation on how to calibrate a line follower in vexcode but I know it’s a thing in Pros. Is there a command to calibrate it or not?

Another question while I was looking at the documentation: what does reflectivity do versus value? both can print % values and there’s no info on reflectivity other than that it is used in the vexcode template and looks like it does the same as value

This is literally everything in the documentation:



1 Like

@jpearman can u explain? The documentation really doesn’t offer a lot.

Note: I am not an official support person, but my experience is valid to be of use to respond.

After doing a quick google search, we can see it utilized as:

Value = LineFollower.value(analogUnits::pct);

But, if you want to receive the full range of the line follower, you must understand that the bit ranges accordingly to how machines work:
12 bit is 0 to 4095, 8 bit is 0 to 255, and 4 bit is from 0 to 15[?]
So, to get the maximum precision, you can do 12 bit via:

Value = Line.value(analogUnits::range12bit);

For everything though, know that:
Darker objects = higher numbers
Lighter objects = lower numbers

If you want to calibrate your line follower, you can print it. You can print it from jpearman’s code here.

Then do something along the lines of

int Value = [result - buffer amount]
if Line.value(analogUnits::pct) > Value {

I would highly suggest enabling expert mode on vexcode, as autofill can seriously help you with getting information, or just going onto the implemented-api inside of the VEXCode software.


Maybe you misunderstood what I meant by calibrate. I mean that some sensors, like the inertial sensor, require a calibration before they can be useful and print accurate values. Does the line follower have such a function? The issue I have is that my line follower fails to work through lexan while other groups seem to have it work just fine. For us, the line follower does not change values significantly when it is behind lexan. The other teams are using Pros which has a calibrate similar to the inertial sensor’a calibrate function while vexcode does not and I’m assuming this is why my line follower is not working.

No, this function does not exist.

1 Like