1. Learn how to control and apply the ultra sensor
The ultrasonic sensor is an input device for detecting distance.
It has two eyes:
Detection range: 3cm~400cm; Detection angle: 30 degrees
Repeat encased script for specified times, and then continue to perform the following script.
Repeat until condition is satisfied. When the condition is not satisfies, the wrapped script will constantly run. If met, the program will move on to the following scripts.
The encased script keeps running and cannot be terminated.
Ultrasonic sensor block: to give feedback on the distance between the ultrasonic sensor and any obstacle in front of it.
(repeat 2. 3. 4. five times)
2. Play mCore buzzer tone with C4
3. Wait 1 second
4. Stop playing sound
5. Green light is turned on one second
6. Repeatedly turn on blue light until pressing button on the mCore
7. Wait 3 seconds
8. Light is turned off
When the mouse moves
forward and hits the apple,
mCore utters a sound.
Repeatedly execute its contained
script -> Display Apple -> Specify
the location that the apple
appears -> Repeatedly move the
apple down until it hit the edge
-> After it hits the edge, hide the
apple
Wait for the mouse to hit the
apple -> play a tone for 0.5
second -> stop the program after
5 apples are collected.
You must use values that are
through constantly repeating
and updating the ultrasonic
sensor to make the position of
the mouse dynamically change.
Try to use loop structure to control RGB light on the baseboard. Let them flash once every second and indicate which building blocks are the loop body.
Try to make the buzzer sound as C4 in 10 times, E5 in 20 times, B6 in 30 times, and then keep repeating. Can you distinguish these loop bodies inside it?