Program Review: Threshold Value
- The program shown below is a sample code for 'Threshold Value' mini-challenge.
Wait Block
Wait for Ultrasonic Sensor
Stops the program flow until the value from the ultrasonic sensor is less than '10'
Robot waits until something blocks its way within 10 cm.
Sound Block
Play file
Plays the sound file named 'Hello'
Robot says "Hello!" when something blocks its way within 10 cm.
Program Review: Backward Until Far
- The program shown below is a sample code for 'Backward Until Far' mini-challenge.
The program assumes that the robot starts while facing an object or a wall less than 30 cm away from it.
Move Steering Block
On
Moves the robot backward at 50% power. No stopping condition.
Start the motors on to move backward.
Wait Block
Wait for Ultrasonic Sensor
Stops the program flow until the value from the ultrasonic sensor is greater than '30'
Robot continues moving backward until the obstacle in front of it is farther than 30 cm.
Move Steering Block
Off
Stops both motors of the robot.
Stops the robot (after Wait Block finishes)