C++ and Line Follower Help

Hellow Y’all! I have some question regarding VCS and C++. I am trying to program the robot to grab the sensor value of a line follower in the three wire port C and I don’t know how to do it, primarily because it isn’t shown as a place-able item in the graphical “ROBOT” tab. The V5 brain can get the value of the line follower in the devices tab, so I know it works with V5. The only problem is trying to obtain the value and use it in C++. I am pretty certain it is possible similar to calling values in port, for say 21 with “PORT21,” but I don’t know how to use it with the three wire ports. Does anyone know how to do it, as well as can someone give an example of pulling the value in, for example, turning a motor until the line follower senses a line, then stop?
By the way, thank you so much for your time answering this question :smiley:

The api says you can get the value of a line follower but it shows the same code snippet for both C++PRO and VEX C++. @jpearman is the api supposed to show this or is this an error?

proof: VEX C++ api link C++PRO api link

Code would be the same for VEX C++ and C++ Pro, somewhere an instance of a line sensor needs to be declared.


vex::line Line( Brain.ThreeWirePort.A );

or alternatively, just use a potentiometer device, they are both analog sensors returning the same values.

3 Likes

Thank you!
Would there be an update to add the rest of the sensors in the future?

2 Likes