Program Review: Red Light, Green Light, Go!
- The program shown below is a sample solution to the
Red Light, Green Light, Go! Mini-Challenge
from Forward Until Color 3.
-
It assumes that the "Traffic Light" can change its color from Red to Green.
For the real, physical setting, the Red object should be replaced with Green object manually.
1_SetMultipleMotors_Block
Turns motors 1 and 6 On at 30% power.
Starts moving the robot forward.
StopMultipleMotors block will need to stop the robot later.
2_WaitUntil_
Stops the program from processing
additional commands until the Color Sensor value
equals to 'colorRed'
Robot waits until it sees the 'Red Light'.
3_StopMultipleMotors_
Stops motors 1 and 6.
Stops the robot when it see the 'Red Light'
(after the WaitUntil block finishes).
4_WaitUntil_
Stops the program from processing
additional commands until the Color Sensor value
equals to 'colorGreen'
Robot waits until it sees the 'Green Light'
5_Forward_blah
Moves the robot forward for 1 rotation at 30% power.
The robot drives forward on the 'Green Light'.
Program Review: Move Until Far
- The program shown below is a sample solution to the
Forward to Stop Line Mini-Challenge
from Forward Until Color 3.
-
The solution below is for robots that are driving on a black road with yellow markings.
1_SetMultipleMotors_Block
Turns motors 1 and 6 On at 50% power.
Starts moving the robot forward.
StopMultipleMotors block will need to stop the robot later.
2_WaitUntil_
Stops the program from processing
additional commands until the Color Sensor value equals to 'colorYellow'.
Robot waits until it sees Yellow line on the black road.
3_StopMultipleMotors_Blah
Stops motors 1 and 6.
Stops the robot (after the WaitUntil block finishes).