Chapter 7. Advanced Programming
In this chapter, we will explore some more advanced algorithms with a focus on what we need for navigation. This will be particularly useful for programming your robot to navigate an obstacle course or play a complex game, such as FIRST Lego League. In this chapter, we will cover how to:
- Use Loops and Switches to drive in a square
- Use Loops and Switches to avoid an obstacle
- Navigate using Motor Rotation sensor feedback
- Navigate using Gyro Sensor feedback
- Simplify our program using My Blocks
- Simplify our program using Arrays
Using any of our four base robots, we will make the robot go forward, make a 90 degree turn, go forward, and repeat this sequence several times. In this chapter, I have included programs using both the Gyro Sensor and a process of navigation called dead reckoning. Dead reckoning, which is short for deduced reckoning, consists of calculating how far the wheels of your robot should turn by using the built-in shaft encoders (Motor Rotation...