Hi everyone,
Has anyone here worked on a line-following robot that uses the optical sensor to follow the black lines on the VEX field? I’m having trouble with mine—it doesn’t seem to detect the lines correctly.
I remember that in the previous version of VEX, they used to provide an example code for this, but it seems like it’s no longer available. If anyone has a working solution, could you please share your code or provide some tips?
I’d really appreciate the help!
Thanks in advance!
Also, students are coding with blocks and working on the Hour of Code challenge maze. However, I’ve adapted the challenge to involve line-following within the maze.
Hi! This seems like a cool challenge. The example still exists in the IQ 1st gen section of VEXcode IQ, so this could be a good starting point. I think the biggest piece will be getting the brightness and light values correct – too bright and the line may reflect the light and give false values, too dark and the shadow of the robot could create brightness issues.
You may be able to determine the optimal values using the Devices Screen on the robot brain as well! By moving the robot over the line with the Devices Screen open, you should be able to read the brightness values and what threshold value then could be used in the project.
Here’s a link to an article about the Devices Screen (about VEX IQ but all of this applies for EXP as well) – https://kb.vex.com/hc/en-us/articles/4407061189908-Using-the-Devices-Screen-IQ-Brain-2nd-gen
1 Like
Hi Alaina Haws
Thank you so much for the information. I tried it, but it doesn’t seem to work. I made some adjustments to the code because we are using two motors on each side and the 2nd generation optical sensor.
I’ve read the values, and when it’s dark, they range between 0-2. However, the robot keeps turning in circles. Could someone help me troubleshoot this, please?
!
Hmm. I wonder if this has to do with the brightness settings of the LED on the Optical Sensor.
It seems like you’re making some progress forward, but it would probably be easier to troubleshoot over a call! As a PD+ All Access member, you can set up a 1-on-1 chat here: 1-on-1 Sessions
Then either myself or another member of the Education team can help you walk through and troubleshoot together in context.