Robotics C++ Physics II AP Physics B Electronics Java Astronomy Other Courses Summer Session  

Wait Blocks

 

Move Forward, Wait, Move Reverse

Wait for Touch

Loop

Change Direction with Touch Sensor

 

Move Forward, Wait, Move Reverse

Move

You will need an NXT car with two motors. Attach one motor to Port A and the other motor to Port C.

  1. Write a program exactly like the one above. Make sure to change both Move blocks to Ports A and C. Set the Duration of each Move block to 2 seconds. The second Move block should have the Direction set to Reverse.
  2. Run the program, and observe the behavior of the NXT car.
  3. Change the amount of time that your car moves forward and backward.
  4. Run the changed program and again, note the behavior of the NXT car.


Wait For Touch

Wait For Touch 

You will need an NXT car with two motors and a touch sensor. Attach one motor to Port A and the other motor to Port C.

Attach the touch sensor to Port 1.

  1. Write a program exactly like the one above. Make sure to change the Move block to Ports A and C. Set the Duration of the Move block to 2 seconds. The Wait block should be set to wait for the touch sensor to be pressed.
  2. Run the program, and observe the behavior of the NXT car when you press the touch sensor.
  3. Change the Wait block to wait for the touch sensor to be bumped (pressed and released once).
  4. Run the changed program and again, note the behavior of the NXT car.

Loop

Loop
 

You will need an NXT car with two motors and a touch sensor.

Attach one motor to Port A and the other motor to Port C. Attach the touch sensor to Port 1.

  1. Write a program exactly like the one above. Make sure to change the Move block to Ports A and C. Set the Duration of the Move block to 2 seconds. The Wait block should be set to wait for the touch sensor to be pressed. The loop should continue forever.
  2. Run the program, and observe the behavior of the NXT car when you press the touch sensor.
  3. Press the touch sensor again, and observe the behavior of the NXT car. How many times do you think the car will perform this same behavior when the touch sensor is pressed?
  4. Run the changed program and again, note the behavior of the NXT car.


Change Direction with Touch Sensor

Change Direction

You will need an NXT car with two motors and a touch sensor.

Attach one motor to Port A and the other motor to Port C. Attach the touch sensor to Port 1.

  1. Write a program exactly like the one above. Make sure to change the Move blocks to Ports A and C. Set the Duration of both Move blocks to Unlimited. The second Move block should have the direction reversed. The Wait blocks should be set to wait for the touch sensor to be pressed. The loop should continue forever.

  2. Run the program, and observe the behavior of the NXT car when you press the touch sensor.
  3. Press the touch sensor again, and observe the behavior of the NXT car. What has changed?
  4. Keep the program running, and continue to press the touch sensor multiple times. You have made the touch sensor into a toggle switch for the direction of the motors of your car!