- :-
Mini-challenge solutions

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.
1_ResetGyro_have you reset everytime? Reset the Gyro Sensor's value to 0. Set the Gyro Sensor to register the current position of the robot as "0 degrees".
2_SetMotor_sets just one motor Turns motor B On at 35% power. Starts turning the robot to the right by driving the left side of the robot forward.
3_SetMotor_ Turns motor C On at -35% power. Starts turning the robot to the right by driving the right side of the robot backward.
4_WaitUntil_ Stops the program from processing additional commands until the Gyro Sensor's Degrees value is more than 80. Robot waits until it havs turned to the right 80 degrees.
5_StopMultipleMotors_blah Stops motors B and C. Stops the robot (after the WaitUntil block finishes).

Program Review: Square Box Challenge

  • The program shown below is a sample solution to 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.
1_SetLEDColor_ Sets the EV3's LED color to Orange.
2_Forward_ Moves the robot forward 5.5 rotations at 50% power. The robot drives along the side of the box.
3_SetLEDColor_ Sets the EV3's LED to flash Red.
4_ResetGyro_ Resets the Gyro Sensor's value to 0. This sets the Gyro Sensor to register the current position of the robot as "0 degrees".
5_SetMotor_ Turns motor B On at 35% power. Starts turning the robot to the right by driving the left side of the robot forward.
6_SetMotor_ Turns motor C On at -35% power. Starts turning the robot to the right by driving the right side of the robot backward.
7_WaitUntil_ Stops the program from processing aditional commands until the Gyro Sensor's Degrees value is more than 80. Robot waits until it has turned to the right 83 degrees, (Approx 90 degrees to the right).
8-14_RepeatedPattern_ Copy of the behavior pattern used earlier in the program. Robot turns LED Orange and moves forward 5.5 rotations along the side of the box, resets Gyro value to 0, and blinks Red LED as it turns to the right until the Gyro Sensor's value is greater than 80 degrees.
15-21_RepeatedPattern_ Copy of the behavior pattern used earlier in the program. Robot turns LED Orange and moves forward 5.5 rotations along the side of the box, resets Gyro value to 0, and blinks Red LED as it turns to the right until the Gyro Sensor's value is greater than 80 degrees.
22-28_RepeatedPattern_ Copy of the behavior pattern used earlier in the program. Robot turns LED Orange and moves forward 5.5 rotations along the side of the box, resets Gyro value to 0, and blinks Red LED as it turns to the right until the Gyro Sensor's value is greater than 80 degrees.
29_StopMultipleMotors_ Stops the robot (after the WaitUntil block finishes).