Clean Sweep
This activity gives the students practice in using case structures and multiple loops.
Objectives
1. To write a program containing multiple loops and case structures.
2. To construct a plow or other device for moving objects.
Materials
NXT
Computer
Motors
Touch sensors
LEGO® pieces, including wheels and bricks
Tape for making the boundaries of the playing field
Time: Approximately 50 minutes
Notes
1. This activity follows naturally from Push-Button Motor and the other basic
programming activities, which makes it a good culminating activity for an
introduction to programming. Each touch sensor runs one of the motors; by
pushing one or both of the touch sensors, the driver can make the car turn or go
straight.
2. A reasonable playing field is a square one meter on each side, containing 100 2
x 2 or 2 x 4 LEGO® bricks.
3. Most groups will attach some sort of plow to the front of the sweeper to push
bricks out of the way. If you wish, you can remove the size restriction and let the
students try very long plows.
4. You may wish to award prizes for successfully removing bricks from the field,
perhaps a small reward for every ten bricks removed, plus a larger reward for a
clean sweep.
5. A possible program is shown below, in which each motor is controlled by a touch
sensor. When the sensor is not pressed, the corresponding motor is stopped.
Another possibility is to have the motors run forward when the touch sensors are
pressed and backwards when they are released.
Clean Sweep
This activity gives the students practice in using case structures and multiple loops.
Objectives
1. To write a program containing multiple loops and case structures.
2. To construct a plow or other device for moving objects.
Materials
NXT
Computer
Motors
Touch sensors
LEGO® pieces, including wheels and bricks
Tape for making the boundaries of the playing field
Time: Approximately 50 minutes
Notes
1. This activity follows naturally from Push-Button Motor and the other basic
programming activities, which makes it a good culminating activity for an
introduction to programming. Each touch sensor runs one of the motors; by
pushing one or both of the touch sensors, the driver can make the car turn or go
straight.
2. A reasonable playing field is a square one meter on each side, containing 100 2
x 2 or 2 x 4 LEGO® bricks.
3. Most groups will attach some sort of plow to the front of the sweeper to push
bricks out of the way. If you wish, you can remove the size restriction and let the
students try very long plows.
4. You may wish to award prizes for successfully removing bricks from the field,
perhaps a small reward for every ten bricks removed, plus a larger reward for a
clean sweep.
5. A possible program is shown below, in which each motor is controlled by a touch
sensor. When the sensor is not pressed, the corresponding motor is stopped.
Another possibility is to have the motors run forward when the touch sensors are
pressed and backwards when they are released.
การแปล กรุณารอสักครู่..
