GB+USA
If the pointer does not move away from its maximum deflection, we should
check the connections of the phototransistor once again. On the other hand,
if the pointer points to zero when the flashlight is switched off, the lighting
in the room, i.e., the ambient brightness, can be excessive. The pointer de-
flection changes when we cover the phototransistor.
We would like to talk briefly about the color assignment of the plugs
again. We should pay very close attention during assembly to ensure that
a red plug is connected to a red wire and a green plug to a green wire.
If we use polarized signals in circuit design, we always use a red wire for
the plus pole and a green wire for the minus pole. This might seem a bit
pedantic (and the electric current does not care which color a wire has),
but clear and unique color assignment simplifies systematic searches for
errors substantially.
We want to conclude our first step into the area of robotics with a simple
program. Set up the basic model with the two drive motors and the support
wheel according to the construction instructions. Only connect the motors to
the outputs M1 and M2. Also take the phototransistor and connect it to
input E3 (pay attention to the polarity). Before you do this, attach the
phototransistor to the basic model, so that it looks "forward." If
sheet appears with a little green man and the block window. The little green
man symbolizes the program start.
All our programs begin from this starting point. We retrieve the various
program parts from the block window using the mouse. The symbols there
18
you want to, you can connect the lens lamp to M3
and attach it next to the battery pack, for
example, but this is not absolutely necessary.
Open the LLWin program and create a new
project (PROJECT – NEW). LLWin provides
us various templates; select "Empty
project" and give it a name, e.g., "Step
1". After you press the [OK] button, a blank work
stand for the inputs and outputs on the interface. We can place the desired
symbol using the mouse button on the left, and change the properties using
the mouse button on the right.
The pushbutton symbol identifies an input. Place the pushbutton under the
start symbol for our program. Once you release the symbol, a selection
dialog appears. Select phototransistor. If you want to make changes later,
you can activate this dialog using the mouse button on the right. Assign the
outputs to the motors and indicate the desired rotational direction. We want
the motors to rotate in the same direction when no light hits the photo-
transistor, and in the opposite direction when light is detected. Then link
the elements using the draw function. The lamp on M3 signals the state of
the phototransistor.
The drawing shows the precise link of the program branches. If you are
not certain whether everything is correct, compare your program with the
Step1.mdl program. Save your own program before you do this, and load
the Step1.mdl file from the CD-ROM, which is contained in the construction
kit.
If everything is correct, the program is downloaded into the interface and
started immediately (RUN - DOWNLOAD).
The first robot then rotates on one spot. It does this until we attract him
with a light source. As soon as the phototransistor detects the light, the
motors, which previously rotated in opposite directions, are rotated in the
same direction and the robot moves straight toward the light source. If it
moves away from the light source, we must change the poles of both
motors. It will probably not move in a precisely straight direction, so that
the phototransistor will lose contact to the light source after part of the
way. Then its movement will switch from Move forward to Rotation, and the
light search starts anew. Provide sufficient space for the robot, since it can
unfortunately not (yet) detect obstacles in its path.