Hobbies And Interests
Home  >> Toys >> Construction Toys

How to Control a Mindstorm With Another Mindstorm

LEGO Mindstorms is a robot construction set with which you build a robot with an electronic Mindstorms NXT brick, motors and LEGO pieces, and then download a set of computer instructions from the Mindstorms software to the brick and bring your robot to life. In many cases, the instructions are predetermined with a limited number of options, but you can use the Bluetooth connection capability to use one Mindstorms NXT brick to control another one like a remote control car, giving your robot a more dynamic set of options.

Instructions

  1. Remote Control Program

    • 1

      Open the Mindstorms program on your computer and click on "File" and then "New" to start a new program. Click on "loop" and add it to the project. This loop will contain every command in this program.

    • 2

      Add a Variable button test block to the chain with a "0" value. Connect a switch button to the chain, uncheck the "Flat view" option in the properties box and add another button test block inside of the switch loop. Change the switch's sensor to "NXT Buttons" and its button value to "Left Button." Click on the button test inside the loop and change its value to "1."

    • 3

      Create two more switches with button test variables and connect them to the chain. Change the middle switch's button value to "Enter Button" and the button test value to "2." Change the third switch's button value to "Left Button" and the button test value to "3."

    • 4

      Add two more variables to the chain. Set the first as a button test and the second as a button. Use the spool to connect a thread between the number signs below each variable. When you run the program, these variables will send the button you have pressed on the NXT brick remote to the NXT brick on the robot.

    • 5

      Add another variable to the chain and set it to "Button." Add a "Send Message" block to the chain and also connect it to the variable beside it using the thread spool beneath the two blocks. Change the message value to "Number" and leave the mailbox set to "1."

    • 6

      Save this program and download it to the NXT brick you will use as the remote control.

    Robot Program

    • 7

      Click on "File" and select "New" to start a new program. Add a loop and connect it to the starting point's bottom chain. This loop will receive instructions from the NXT remote brick. Within this loop, add another loop to the chain and change its control value to "Logic."

    • 8

      Connect a receive message block within the second loop. Change the message value to "Number" and use the thread spool to connect the "Message Received" option to the loop containing this block. Leave the mailbox set to "1."

    • 9

      Connect a variable button to the outside of the inner loop, but still within the larger loop. Change the option to "Button" and the action to "Write." Connect a thread from the receive message block to this variable. This part of your program will read instructions sent to it from the remote.

    • 10

      Connect a variable block to the main chain from the starting point and change it to a "button." Connect a forever loop block to the chain. Connect another variable block and set it to "button." Connect a switch to the chain and change the control to "Value," the type to "Number" and uncheck the "Flat View" box.

    • 11

      Add a variable block, logic block and two move blocks to the chain within the switch block. Set the variable block to "Direction" and connect the value thread spool to "A" underneath the logic block. Change the operation of the logic block to "Not" and connect the result thread spool to direction underneath the first move block.

    • 12

      Change the port of the first move block to "A" and the durations value to "Unlimited." Change the direction value of the second move block to "Stop."

    • 13

      Save this program and download it to the NXT brick of your robot.

    Control the Robot

    • 14

      Turn on the Bluetooth connection on both NXT bricks in the NXT main menu.

    • 15

      Go to the Bluetooth menu on the remote control NXT brick and pick "Search." Choose the robot's NXT brick from the list and choose "Connect" using connection number one. Enter "1234" for the passkey on both NXT bricks if necessary.

    • 16

      Press the "Run Program" option for the remote control NXT brick. Press the "Run Program" option for the robot's NXT brick. You can now control the direction your robot moves using the left, right and enter buttons on the remote control NXT brick.


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