Hobbies And Interests
Home  >> Toys >> Construction Toys

How to Make a LEGO Mindstorms NXT Alpha Rex Avoid Objects

Programming the LEGO Mindstorms NXT robots is a fairly simple project, which uses a visual style. If you have made a robot before, you likely have some experience working with the programming language. To program your Mindstorms Alpha Rex, you will need to know some of the basics of Mindstorms programming, including programming motors and sensors and making subroutines.

Things You'll Need

  • Bluetooth chip or dongle (optional)
Show More

Instructions

    • 1

      Build the LEGO Mindstorms Alpha Rex model according to the directions. The directions for the model are listed under References.

    • 2

      Connect the LEGO NXT brick to your computer using the Bluetooth or included USB cable. Run the NXT programming software.

    • 3

      Program three subroutines, one for walking forward, one for turning left, and one for turning right. To walk, use move blocks to program one leg to move and the motor on the back to tilt in the direction of the opposite leg. Repeat with the other legs to create walking movement. To turn, program one leg to move at a time. You may find it helpful to tilt the robot in the same direction as the tuning leg. If you have built the model before, you may already have these routines saved.

    • 4

      Program the robot to walk forward until the IR sensor picks up an obstacle. You can set the distance to be as close or far as you prefer.

    • 5

      Place a switch block on the end of the line. Program the block to randomly choose one of the two paths which it selects as an option.

    • 6

      Place the left and right turn blocks on the two branches of the switch block. This makes it so that the robot will randomly turn left or right when it detects an obstacle.

    • 7

      Place the entire program inside a loop. If you set the loop to infinite, the robot will walk forward indefinitely and turn when it sees obstacles. You can also set it to perform this only a few times.


https://www.htfbw.com © Hobbies And Interests