- :-

Program Review: Turn for Angle (90 degrees)

  • The program shown below is from the main Turn for Angle lesson.
  • The robot turns on its motors in opposite directions to create a turning motion, then leaves them on while Waiting for the Gyro Sensor reading to change by more than 80 degrees. When it does, the program turns the motors off and the robot stops.
  • This turns the robot approximately 90 degrees to the right. The smaller sensor target of 80 degrees compensates for the robot's tendency to "overturn".
Hover on any block in the program to view a detailed explanation.
Move Steering Block On Turns in place to the right at 50% power. No stopping condition. Turn on the motors so the robot turns in place to the right.
Wait Block Gyro Sensor - Change - Angle Stops the program flow until the value from the gyro sensor is greater than '80' Robot waits until the robot's body has turned more than 80 degrees.
Move Steering Block Off Turns Motors B+C Off, and sets them to a Braking state. Stops the robot. Note that the program can only reach this block after the "Wait for Gyro" block finishes.

Program Review: Square Box challenge

  • The program shown below is a sample solution for the Square Box mini-challenge, using the Gyro sensor to perform all four turns.
  • Each side of the box uses a similar behavior: Move forward for a distance, then turn 90 degrees to the right.
  • Each right turn is accomplished using a Turn until Angle behavior: Turn the motors on, wait for the gyro to register 80 degrees of change, then stop the motors.
Hover on any block in the program to view a detailed explanation.
Move Steering Block On for Rotations Moves the robot forward 3 wheel rotations at 50% power. Moves forward.
Move Steering Block On Turns in place to the right at 50% power. No stopping condition. Turn on the motors so the robot turns in place to the right.
Wait Block Gyro Sensor - Change - Angle Stops the program flow until the value from the gyro sensor is greater than '80' Robot waits until the robot's body has turned more than 80 degrees.
Move Steering Block Off Turns Motors B+C Off, and sets them to a Braking state. Stops the robot. Note that the program can only reach this block after the "Wait for Gyro" block finishes.
Move Forward, then Turn 90 degrees to the Right Copy of the behavior pattern used earlier in the program. Robot moves foward for 3 rotations. Then turns 90 degrees to the right using the gyro sensor.
Move Forward, then Turn 90 degrees to the Right Copy of the behavior pattern used earlier in the program. Robot moves foward for 3 rotations. Then turns 90 degrees to the right using the gyro sensor.
Move Forward, then Turn 90 degrees to the Right Copy of the behavior pattern used earlier in the program. Robot moves foward for 3 rotations. Then turns 90 degrees to the right using the gyro sensor.