Key Focus 5 - Avoid Obstacles - TTS InO-Bot Blockly Teachers Manual

Table of Contents

Advertisement

Key Focus 5 – Avoid obstacles
On the front of InO-Bot there is an ultrasonic range finder. This is a sensor that reports
values from 0 to 255. The values are reported in centimetres and indicate how far an
object is from the front of the sensor. InO-Bot can be programmed to move around
and when the range finder reports an obstacle at a given distance in front it can back
up and turn.
The 'repeat while true' (forever) loop contains a
conditional check. If the distance sensor reports an
object less than 20cm in front, the program makes
InO-Bot reverse, turn and then start moving forward
again.
There is a sound added ('Play sound 1') to indicate
when an object is detected. The additional wait
ensures commands run.
Children should experiment with the commands above and spend time working out the
optimum trigger distance. Should it be more or less than 20cm? There may be some
discussion around the trigger point. Does InO-Bot react at exactly 20cm? If not, why
not? Often it will be a little less and this is due to reaction time, i.e. the sensor sends
data back to the PC, Scratch then needs to read that data and send commands to
make InO-Bot do something else. Data needs to be sent back and forth. Although this
data transmission is speedy there is still some lag. Are children able to modify their
program to address this? For example, they may put 25cm when they want InO-Bot to
stop at 20cm.

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents