Hey everyone. My son's FLL team got a Spike Prime kit for this season and we've been playing around with the Scratch programming language for it. We're having trouble getting a line follower to also travel a specified distance. Using the proportional line follower found at https://primelessons.org/, we were able to get a line follower working no problem. However, when we wanted to have the robot follow a line for a specified distance, we ran into issues.

I have an EV3 robot and so we played around with Scratch and our EV3 and managed to get the line follower to go a specified distance by calculating the number of degrees of rotation the motor turned to move the robot one inch. Then we wrapped the line follower with a conditional block that checked the degrees rotated by both motors and when they reached the required distance, we stopped the robot. (This is not 100% accurate, as slippage or turns can cause slight extra rotation, but it was close enough for our purposes).

However, when we tried to use the same code on the Spike robot, we discovered that the degrees rotated variable wraps from 360 to 0, instead of continuously incrementing like it does with EV3. So the program never hit the degress of rotation we wanted and it never stopped.

We have yet to find a way to measure the full distance traveled with the Spike. We don't see a block that returns the number of rotations of the motors or a way to keep the rotated degrees incrementing past 360. We know there's a movement block to travel a certain distance, but we don't know how to incorporate that with a line follower. We are currently using a timer to time how long the robot runs before stopping, but obviously if we ever change the speed of the motors, the timing will be off, so we can't easily make adjustments.

Any help would be greatly appreciated. I've attached an image of our code that works with EV3, but we need something that will work with Spike.

Thanks!

I have an EV3 robot and so we played around with Scratch and our EV3 and managed to get the line follower to go a specified distance by calculating the number of degrees of rotation the motor turned to move the robot one inch. Then we wrapped the line follower with a conditional block that checked the degrees rotated by both motors and when they reached the required distance, we stopped the robot. (This is not 100% accurate, as slippage or turns can cause slight extra rotation, but it was close enough for our purposes).

However, when we tried to use the same code on the Spike robot, we discovered that the degrees rotated variable wraps from 360 to 0, instead of continuously incrementing like it does with EV3. So the program never hit the degress of rotation we wanted and it never stopped.

We have yet to find a way to measure the full distance traveled with the Spike. We don't see a block that returns the number of rotations of the motors or a way to keep the rotated degrees incrementing past 360. We know there's a movement block to travel a certain distance, but we don't know how to incorporate that with a line follower. We are currently using a timer to time how long the robot runs before stopping, but obviously if we ever change the speed of the motors, the timing will be off, so we can't easily make adjustments.

Any help would be greatly appreciated. I've attached an image of our code that works with EV3, but we need something that will work with Spike.

Thanks!

## Comment