nxtprograms.com

Fun Projects for your LEGO MINDSTORMS NXT!

Home     Projects     Help     Contacts

5 Button Remote Control
Building: Easy
Program: Intermediate

Building Instructions


1

(You can use the NXT with either AA batteries or the NXT Rechargeable Battery Pack.)


5 Button Remote Control Programming
 
Download Program (help)

The 5ButtonRemote program for the remote control provides one general purpose way to send Bluetooth messages from the remote control to another NXT (other strategies are possible).  A receiving program on the other NXT must be used to interpret the Bluetooth messages and take action.  For example, see the 5ButtonSteer program from the Race Car project.  Instructions to use the remote with the Race Car are below.

The 5ButtonRemote program sends two different kinds of Bluetooth messages to two different mailboxes on the receiving NXT: 

  1. The first message, sent to mailbox 1, is a Number that indicates the state of the two touch sensors as follows: 0 = Neither pressed, 1 = Left only pressed, 2 = Right only pressed, 3 = Both pressed.  These messages are sent continuously at about 20 messages per second (even when the sensor state has not changed since the last message).

  2. The second message, sent to mailbox 2, is a Number that indicates when an NXT button is bumped (pressed and then released) as follows: 1 = Left Arrow button, 2 = Enter button, 3 = Right Arrow button.  These messages are only sent when an NXT button is bumped and are only sent once for each bump.

 

Using Bluetooth Wireless Remote Control with Two NXTs

You will need another NXT to receive the messages from the remote control and an appropriate receiving program for that NXT project.  The following example instructions show how to set up an connection between the 5 Button Remote Control and the Race Car project.

  1. Download the 5ButtonSteer program to the Race Car NXT, but don't run it yet.

  2. Download the 5ButtonRemote program to the 5 Button Remote Control, but don't run it yet.

  1. Establish a Bluetooth connection from the remote control to the Race Car.  See your NXT User Guide for instructions, summarized here:

    1. Make sure Bluetooth is turned on for both NXTs from the Bluetooth menu (from NXT main menu)

    2. From the NXT for the remote control, go to the Bluetooth menu, and if this is the first time these two NXTs have been connected, pick Search.  Pick Contacts if they have connected before.

    3. Choose the name of the NXT for the Race Car from the list and connect.

    4. Connect using connection number 1

    5. If prompted for a Passkey, you can accept the default 1234 key on both NXTs

    6. The NXTs are connected when they both display a diamond after the Bluetooth icon in the upper left corner of the screen.

  2. Run the 5ButtonRemote program on the remote control NXT.

  3. Run the 5ButtonSteer program on the Race Car NXT.

  4. The Race Car will operate from the remote control as follows:

    • With neither touch sensor pressed, the car stops.

    • Press and hold both touch sensors to drive forward.

    • Press and hold the left touch sensor to turn left, or the right touch sensor to turn right.

    • Press and release the Left Arrow button to decrease the drive power (speed) by 20%, and the Right Arrow button to increase speed by 20%.  The current power level is displayed on the Race Car NXT (not the remote NXT).

    • Press and release the Enter button to toggle Reverse mode (once to shift into Reverse and again to go back to forward).  When in Reverse mode, the car will drive and turn in reverse.

Note that you could use the 5 Button Remote Control to control another NXT project that can respond in any way it wants to the Bluetooth messages described in the Programming section above, so you could assign other actions to the five available buttons if you want.

 

Challenges
  • Design your own robot to use with the 5 Button Remote Control and write a Bluetooth receiving control program for it to use.

  • Try modifying the 5ButtonRemote program to make the remote control work better or differently for your own robot designs.  For example, you might want to change the NXT button behavior from "bumped" to "press and hold", or perhaps add some feedback on the display.

  • Note that a limitation of the NXT is that it cannot sense two NXT buttons (Left Arrow, Enter, Right Arrow) being pressed at the same time.  However, it can sense two touch sensors pressed at the same time, and touch sensor(s) pressed at the same time as one NXT button.  So, math question: How many different combinations of the 5 buttons can the remote control sense?

  • Can you use or modify the remote control to control something that is not a vehicle?

 

Home     Projects     Help     Contacts

 

Copyright 2007-2011 by Dave Parker.  All rights reserved. 
All project designs, images, and programs are protected by copyright.  Please see the usage policy.