Week 5 – 2019 – Oliver

This week I updated my line-following code to include the hint-finding MyBlock. I had to connect the logic output to a logic variable, which cut the program out of the infinite loop.

My updated line following code

To incorporate the hint-finding code into my program, first I had to make a MyBlock of what the robot should do when it comes across a hint. The program finds the direction the hint is facing based on which sensor is receiving more light. If the left sensor is receiving more light than the right sensor, the robot turns left and vice versa. I put a Display block to show whether the robot was meant to be turning right or left. The wait block is at the end so you can read the display.

The testing code for the MyBlock

The robot turned on the hints the right way when it found them, but it had a problem when it came to the silver. The program found a hint before the silver, meaning the program must have detected a light difference higher than 1.

When I looked in port view, the difference between the two sensors when the robot was on silver was 3. I changed my code to accommodate for this by making the difference 5, but the robot still detected a hint before it came to a stop. This is a mystery that remains unsolved and will do until next term.

Useless Fact of the Day: 99% of all the mass of the solar system is concentrated in the sun.