Let’s test the function! Use electrical tape or the driving school mat (if you have one) and line Zumi up on the starting black line. You can download a line following worksheet here. The function line_follow_gyro() needs many parameters. Set the speed to a relatively low speed and set the program for 3 seconds (or more, depending on how long your line is!).
If you think that Zumi is not detecting the lines very well, or that the difference between dark and light is not big enough, you might need to adjust the thresholds, or limits, that the IR sensors will detect. Their default is set to 100. Refer to the IR Sensor lesson to test your IR sensors and figure out your thresholds.
If you think that Zumi is turning too little or too much, change the angle adjustment parameter.
Note: This function calls a while loop. If both of the IR sensors see white (the end of the line), the code will automatically stop, even if the time was not completed.