Program Review: Threshold Values
- The program shown below is a sample solution to the
Threshold Values Mini-Challenge
from Forward Until Near 3.
-
Keep in mind that, in this challenge, the robot must drive backwards to move "forward".
This is so that it moves with its Distance Sensor facing the front.
1_SetMultipleMotors_Block
Turns motors 1 and 6 On at -20% power.
Starts moving the robot backward
(driving 'forward' with Distance Sensor), towards the wall.
StopMultipleMotors block will need to stop the robot later.
2_WaitUntil_first wait block
Stops the program from processing
additional commands until the Distance Sensor value is less than 750 ('< 750')
Robot waits until the wall is less than
750 mm away.
3_SetTouchLEDColor_first TOUCHLED block
Sets the value of the TouchLED as 'colorYellow'.
Lights TouchLED in Yellow.
4_WaitUntil_first wait block
Stops the program from processing
additional commands until the Distance Sensor value is less than 500 ('< 500')
Robot waits until the wall is less than
500 mm away.
5_SetTouchLEDColor_
Sets the value of the TouchLED as 'colorOrange'.
Lights TouchLED in Orange.
6_WaitUntil_first wait block
Stops the program from processing
additional commands until the Distance Sensor value is less than 250 ('< 250')
Robot waits until the wall is less than
250 mm away.
7_SetTouchLEDColor_
Sets the value of the TouchLED as 'colorRed'.
Lights TouchLED in Red.
8_StopMultipleMotors_
Stops motors 1 and 6.
Stops the robot (after the WaitUntil block finishes).
Program Review: Move Until Far
- The program shown below is a sample solution to the
Move Until Far Mini-Challenge
from Forward Until Near 3.
-
It assumes that the robot starts facing a wall that is less than 300mm away
from the robot's Distance Sensor.
-
Keep in mind that, in this challenge, the robot must drive backwards to move "forward".
This is so that it moves with its Distance Sensor facing the front.
1_SetMultipleMotors_Block
Turns motors 1 and 6 On at 50% power.
Starts moving the robot forward
(driving 'backward' with Distance Sensor), away from the wall.
StopMultipleMotors block will need to stop the robot later.
2_WaitUntil_
Stops the program from processing
additional commands until the Distance Sensor value is greater than 300 ('> 300')
Robot waits until the wall is more than
300 mm away before continuing the program.
3_StopMultipleMotors_Blah
Stops motors 1 and 6.
Stops the robot (after the WaitUntil block finishes).