1 + 3;
which should give you the value 4.
Now try
printf("Hello Handy Board\n");
which will print the message Hello Handy Board on the LCD screen
on the board.
Record the results of each of your tests. The product to be turned
in for a grade will be a summary of your test results.
Connect one of your motors to motor port 0. Then turn it on in the
forward direction by typing:
fd(0);
This should turn on the motor at full power.
Now try changing the power of the motor:
motor(0, 10);
Try a variety of power levels.
Now turn off the motor:
off(0);
Does the motor work correctly? Record your results. What if you turn
it on in the backward direction? Does it still work correctly?
Do the same for your second motor.
Now repeat this process for one of the motors and ports 1, 2, and 3.
While the primary objective of this lab is to test the wiring you did
for the motors and sensors, a second objective is to test the Handy Board
you'll be using for the rest of the semester.
To summarize:
digital(7)
Record the result.
Now do the same, but with the sensor depressed, and record the result.
Now test your second digital sensor in the same way.
Next, move one of the touch sensors to
port 8, and test it there. Does your sensor work correctly? Are
both ports operating appropriately? Repeat this for each digital port,
recording the results for each port.
To summarize:
Once you have completed this, select a single port for each of your
remaining light sensors (i.e., the photocells),
and explore the full range of readings for each one. Try a variety of
different lighting conditions (overhead
light on, overhead light off, flashlight pointed directly at the sensor,
flashlight pointed directly but at increasing distances, sensor covered
by hand, etc.) What do high values correspond to? Low values?
What value do you get for the port when no sensor is connected?
Now shield your photocell light sensor. (See page 83 of Martin or my
sample light sensors for examples.) What sort of readings do you get now?
Try a number of different lighting conditions.
Finally, get a piece of white reflective paper and some black electrical tape.
Record the reading you get with each sensor when it is positioned over the
white paper and then over the black tape.
To summarize:
This lab must be completed by Monday, September 22 at 10:00 PM.
Testing Motors and Sensors
You should have the two motors, two touch sensors, and three light sensors
that you wired last week.
In order to make the testing of your
motors easier, I will provide you with Lego wheels that can be attached
directly to the motors. You can use these to get a sense of the direction
and speed of your motors.
Motors
You should test a number of attributes of your motors: whether they
turn on both forward and backward; whether they change speed; whether they
turn off.
Touch Sensors
Connect one of your digital (touch) sensors to port 7. (The digital ports
are those numbered 7-15.) Now type the following in IC:
Light Sensors
Testing light sensors will be a bit more complicated. You will begin by
testing the Lego light sensor in a manner similar to that above for
digital sensors. Test the sensor in each port. (The analog ports are
those numbered 0-6.)
In each instance, record
the reading of the sensor when covered (by your hand, for example) and
when fully illuminated (with a flashlight, for example).
Requirements
Each group must turn in a summary of all of their test results. Keep
individual copies as well. You will find these results, especially the
light sensor results, useful in future labs.