Users Manual
CLASS 3
74
Coding the Ultrasonic Turtle
Have you tried coding for the rest of the LED sensors? Now you can combine your scripts into one. If you followed
this process well then you should have a script like this!
The script shown above now turns on the LED sensors one at a time as the distance from the wall increases. If the
distance value is less than 15, all three LED sensors are turned off. If the distance value is greater than 15 and less
than 20, one LED sensor is turned on (digital output 10 turns on) 'And less than' 25 ', two LED sensors are turned
on, and if greater than' 25 ', three LED sensors are turned on.
You can see that several LED sensors are turned on depending on the distance from the ultrasonic
sensor.
Coding the Ultrasonic Turtle