Thames & Kosmos Robotics Workshop handleiding
Handleiding
Je bekijkt pagina 22 van 68

PROGRAMMING
SAMPLE PROGRAM FOR THE DRAWING ROBOT
Arrange four sheets of paper in a large square and tape them down to a smooth floor or tabletop. Aach a
pencil or marker to the drawing robot, and place the robot near one edge of the paper with the pencil touching
the paper. Test out the program below and see what paern the drawing robot makes. This program is
preloaded in the app in the Load Demo Code menu.
This program shows
how loops can be
placed or “nested”
within other loops.
Variables
Just like loops, variables are another important part of coding. A variable contains a value
that can change depending on the information that the program provides. Initially the
variable item in this block is set to a value of 3.
This loop repeats the following steps 3 times.
This loop repeats the following blocks a number of times equal to the value
set in the item variable. The first time the code is run, the value of the item
variable is 1, but code will change the item variable later in the program.
This portion of code turns on motors 1 and 2, moving the
drawing robot forward.
This portion of code adds 1 to the current value of the item
variable and saves the new value as the item variable. For
example, the first time that the program is run the value of
the item variable is increased from 1 to 2.
Then this portion of code turns the motors in the opposite
directions, so the robot drives backward.
After the first run-through, the loop repeats again, but this
time the drawing robot turns the motors on for twice as long.
What will happen the third time the loop runs?
After the main loop has
repeated 3 times, both
motors are turned off.
Scan this QR code to view
online tech support videos
of the models in action.
20
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
Merk | Thames & Kosmos |
Model | Robotics Workshop |
Categorie | Niet gecategoriseerd |
Taal | Nederlands |
Grootte | 55434 MB |