Thames & Kosmos Robotics Workshop handleiding

68 pagina's
PDF beschikbaar

Handleiding

Je bekijkt pagina 19 van 68
PROGRAMMING
Touch Sensor Robot
17
SAMPLE PROGRAM FOR THE TOUCH SENSOR ROBOT
The touch sensor robot has two touch sensors which tell the robot if it has come into contact with an
object. This program shows how important sensors are to robots. Point the touch sensor robot toward a
flat wall, start the program, and see how the robot responds. This program is preloaded in the app in the
Load Demo Code menu.
Inside the green loop is a block called an if-else-if-else
statement. This loop has four different conditions that the
robot can respond to. The program is read by the robot
from top to boom.
The green loop is called a while loop. This loop will
always repeat as long as the knob sensor data is
greater than 0. This ensures that the robot is always
checking to see if its touch sensors have been pushed.
When both touch sensors (buons 1 and 2) are pressed the robot turns on
both motors so that it will drive backward.
If only touch sensor 1 is pressed, then the robot will turn off
motor 2 and turn on motor 1. This will turn the sensor robot
to the left, moving it away from the object.
If only touch sensor 2 is pressed, then the robot will turn on
motor 2 and turn off motor 1. This will cause the sensor
robot to turn to the right to avoid the obstacle.
If neither of the
touch sensors are
activated, then
the robot will
carry out the else
condition. This
causes both
motors to turn
on, moving the
touch sensor
robot forward.
TIP!
If the touch sensor robot gets stuck
on an object, nudge the robot
towards the object as the touch
sensor may not be fully pushed.
If the robot does not turn in the
correct direction, check that the
wires are connected correctly.
Scan this QR code to view
online tech support videos
of the models in action.

Bekijk gratis de handleiding van Thames & Kosmos Robotics Workshop, stel vragen en lees de antwoorden op veelvoorkomende problemen, of gebruik onze assistent om sneller informatie in de handleiding te vinden of uitleg te krijgen over specifieke functies.

Productinformatie

MerkThames & Kosmos
ModelRobotics Workshop
CategorieNiet gecategoriseerd
TaalNederlands
Grootte55434 MB