troubleshooting and solving connection problems

When building and programming the robots in this book, it’s usually not very difficult to make your robot work by following the instructions. However, sometimes you may run into problems transferring your programs to the NXT. When you do, this appendix will help you find solutions to your problems so that you’ll be able to make your robot work successfully!

NOTE If this appendix doesn’t answer your questions, visit http://discovery.laurensvalk.com/ for more information. By the same token, if you can download a program to the NXT but your robot doesn’t work the way you want it to, there may be a mistake in your program. Visit the book’s companion website to download the ready-made programs and compare them to your own.

using the NXT controller to download programs to the NXT

Once you’ve finished creating a program, you transfer it to the NXT by pressing Download or by pressing Download and Run on the NXT controller in your NXT-G software, as shown in Figure A-1. For the transfer to work, your robot has to be connected to the computer with the USB cable. (For transfers via Bluetooth, see “Connecting to the NXT with Bluetooth” on page 289.)

In addition to these two options, you can also click Download and Run Selected to transfer only selected blocks to your NXT. For example, if your program consists of two Sound blocks and two Move blocks and you select only the Move blocks, pressing Download and Run Selected will transfer only the selected Move blocks to the NXT.

To abort a running program, press the Stop button on the NXT controller.

Image

Figure A-1: Buttons on the NXT controller at the bottom right of the NXT-G programming software allow you to transfer programs to an NXT robot that is connected to your computer.

using the NXT window

When you use one of the NXT controller buttons as discussed in the previous section, your computer should attempt to connect to your robot before downloading the program automatically. If the computer fails to connect, you can try setting up the connection manually using the NXT window (Figure A-2). To open this window, click the NXT Window button on the NXT controller (Figure A-1).

To connect to an NXT with USB, select it from the list (the Status column should read Available), and click Connect. To refresh the list of available NXTs, click Scan. Once connected to an NXT, the NXT window should show the power left in the NXT’s batteries, and the Status column should read Connected.

changing the name of an NXT

Once connected to the computer, you can personalize your NXT by changing its name (its name is “NXT” by default) using the NXT window (Figure A-2). To do this, enter a name in the Name box at the top right of the window, and click the arrow to the right of it to confirm. The name you enter should appear at the top of the NXT’s screen. The next time you use the NXT window to connect to an NXT, the list of NXT devices should show your NXT’s personalized name.

problems connecting to an NXT with USB

If you’re unable to connect an NXT to a computer using the method discussed in “Using the NXT Window,” follow these directions and then try connecting again:

1. Make sure the NXT is turned on.

2. Make sure the NXT is connected to the computer with the USB cable (be sure to check both ends of the cable). The connection is made properly if the NXT displays the letters USB on the top left of its screen.

If this doesn’t help, follow these steps:

1. Turn the NXT off and back on.

2. Close and restart the NXT-G software.

If you still can’t solve your problem, visit the companion website (http://www.discovery.laurensvalk.com/) for more information.

NOTE When you try to connect an NXT to your computer for the first time, you may need administrative rights on your computer in order to succeed. If you encounter this problem, ask your system administrator to log in, launch the NXT-G software, and make the connection to the robot. When you’re done, you should be able to connect to the NXT even using your own account. This should be true for both USB and Bluetooth connections.

Image

Figure A-2: The NXT window lists the NXT devices that the computer can connect to and those it has been connected to previously. The Connection Type column tells you whether the found NXT can be connected to USB or Bluetooth.

problems downloading programs to the NXT

If you can’t transfer a program to the NXT, there may be several causes. Before you proceed to possible solutions, make sure that your robot is connected to the computer by making sure that the Status column in the NXT window says Connected (Figure A-2). If not, your problem is most likely a connection issue. To resolve it, read “Problems Connecting to an NXT with USB” on page 286.

If your robot is physically connected to your computer and you still receive an error message when you try to send a program to the robot (such as the one shown in Figure A-3), carefully read the error message and follow the appropriate instructions in the following sections.

The NXT device is no longer connected.

Although your NXT was connected to the computer, it automatically disconnected. This error message appears when you try to download a program after the USB cable is removed or after the NXT switched itself off after not being used for a long period.

Solution: Turn the NXT on, connect the USB cable, and retry downloading the program.

The NXT device is out of memory.

The programs you download to your NXT are stored in its memory. When you create a program that plays sound files, these files are transferred to the NXT as well. Your NXT has only limited memory, so after making several programs, especially ones using sound files, the NXT will eventually run out of memory.

Solution: Remove files that you no longer need from the NXT’s memory, as shown in Figure A-4. When you’re done, you should be able to download new programs to the robot.

For more on managing files in memory, see the NXT-G’s help files, and click Files and Memory on the NXT in the menu on the left of the help pages.

data wire error messages

When you create a program with incorrectly wired data wires, your program won’t transfer to the NXT. Depending on the type of mistake in your program, you’ll see one of the following error messages.

* There is a data wire that is connected to a plug of the wrong type (see “The Broken Data Wire” on page 166).

* There is more than one data wire connected to the same input plug (see “Connecting Multiple Wires to One Data Plug” on page 167).

Image

Figure A-3: A sample error message that may appear when downloading a program to a robot

Image

Figure A-4: To remove files from the NXT’s memory, go to the NXT window and open the Memory tab. This will show a list of files that are currently on the brick, sorted by category. (Here you see only the sound files.) To view files in a particular category, click the category on the left (such as Program Files). Once you’ve located the file you want to remove, select it, and click the Delete button.

* There is a data wire that does not have a data source (see “Using Settings with Both Input and Output Plugs” on page 167).

Solution: Reread the appropriate paragraph in this book to fix incorrectly connected wires. If fixing just one wire doesn’t help, delete some more or all data wires in your program, and reconnect them appropriately.

Cannot download needed file for the program.

This error may occur in programs that use sound or image files that you made yourself. If the software is unable to locate them (most likely because you removed them), you’ll see this error.

Solution: Re-create the files using the sound and image editor in the software.

The program is broken. It may be missing required files.

You see this error when you try to send a program to the NXT that uses a My Block that the programming software can’t find because you deleted or moved it.

Solution: Re-create the My Block, or move it back to My DocumentsLEGO CreationsMINDSTORMS ProjectsProfilesDefaultBlocksMy Blocks. Next, remove the My Block from the program that uses it, and choose a new My Block from the Custom Palette. If this doesn’t help, create a new My Block with a different name.

The file is currently in use on the NXT device.

This error pops up when you try to download a program to your robot with the Download button on the NXT while that same program is currently running.

Solution: Use the Download and Run button instead, or abort the running program by clicking the Stop button before you download it to the NXT.

using Bluetooth to download programs to the NXT

Instead of using the USB cable to transfer programs to your robots, you can plug a Bluetooth dongle (shown in Figure A-5) into a USB port of your computer, which sends the programs to the NXT wirelessly. Once you’ve set up the connection between your computer and the NXT, you transfer programs to the NXT as you would with the USB cable.

Image

Figure A-5: Just one example of a compatible Bluetooth dongle

Bluetooth transfers makes programming a lot easier, because when using Bluetooth, you don’t have to repeatedly connect and disconnect the USB cable each time you download a program.

finding a Bluetooth dongle

There are many compatible Bluetooth dongles, some of which cost less than $10. Generally, it’s not the dongle hardware but its drivers in combination with your computer’s operating system that cause the dongle to work or not. In many cases, you’ll be able to simply plug the dongle into your computer, wait for the drivers to install automatically, launch the NXT-G software, and follow the connection procedure in the next section. The drivers you’ll need will depend on your operating system and your Bluetooth dongle. Be sure to visit the companion website for links to recommended Bluetooth dongles.

connecting to the NXT with Bluetooth

Follow the next steps to set up your first Bluetooth connection between the computer and the NXT:

1. Plug a compatible Bluetooth dongle into a free USB port on your computer. Depending on your operating system, some drivers are automatically located and installed. Usually, it is not necessary to install the additional drivers that come with your dongle.

2. Activate Bluetooth on the NXT by turning the NXT on and navigating to Bluetooth On/Off On.

3. In NXT-G, go to the NXT window, and click Scan to search for your NXT via Bluetooth. This search process may take about 30 seconds. When ready, the list of NXT devices is updated with the NXTs that are available for a Bluetooth connection. If your NXT isn’t listed, click Scan again.

4. Select the NXT you want to connect to (the Connection Type column should read Bluetooth), and click Connect.

5. When you connect an NXT for the first time, the software may ask you to enter a password to protect your connection, but I recommend that you stick with the default password (1234) because this is easier, especially when errors occur, forcing you to run these steps more than once. Click OK to confirm this password.

6. If you had to enter a password in step 5, the NXT should now make a sound and prompt you to enter the same password. Since you’re using the default password, just select the V sign by pressing the orange Enter button on the NXT. Your computer should now automatically install some extra drivers. If no error messages appear, your NXT should now be connected to the computer via Bluetooth, and you should be ready to start downloading programs to it.

You can tell whether an NXT has made a working Bluetooth connection by looking at the top left of the NXT screen, which shows <> when connected and < when not connected to a computer. If you have just one NXT, you can skip all of these steps once you’ve gone through them once. If you try to transfer a program to your NXT the next time you launch the software, the software should automatically try connecting to the NXT it was last connected to, which is, in this case, your NXT via Bluetooth.

problems connecting to an NXT with Bluetooth

Once you’ve set up the Bluetooth connection, you usually won’t have a problem downloading programs to the NXT. If downloading fails but the Bluetooth connection appears to be working correctly, follow the directions in “Problems Downloading Programs to the NXT” on page 287.

However, in some cases, setting up the Bluetooth connection itself is problematic. There is no easy way to solve Bluetooth problems because they vary depending on, for example, which Bluetooth dongle and which operating system you use. Still, the following solutions may help in some cases.

* Make sure you have administration rights on your computer.

* Restart the NXT-G software, and restart your NXT; then retry connecting.

* In the NXT window, remove all the NXT devices that the computer previously connected to by selecting them and clicking Remove. Then click Scan, and when it’s finished searching for NXTs, retry the connection.

conclusion

I hope that this short appendix has helped you find a solution to your problem. Of course, only a few problems and solutions are listed here, and you may have many other questions relating to one of the building or programming instructions in this book. Feel free to post your question to the companion website (http://www.discovery.laurensvalk.com/).

More no-nonsense books from Image no starch press

Image

The Unofficial LEGO® MINDSTORMS® NXT 2.0 Inventor’s Guide

by DAVID J. PERDUE with LAURENS VALK

DECEMBER 2010, 336 PP., $29.95

ISBN 978-1-59327-215-9

Image

The LEGO® Technic Idea Book: Simple Machines

by YOSHIHITO ISOGAWA

OCTOBER 2010, 168 PP., $19.95

ISBN 978-1-59327-277-7
full color

Image

The Unofficial LEGO® Technic Builder’s Guide

by PAWEŁ “SARIEL” KMIEC

NOVEMBER 2012, 352 PP., $29.95

ISBN 978-1-59327-434-4
full color

Image

The Cult of LEGO®

by JOHN BAICHTAL and JOE MENO

NOVEMBER 2011, 304 PP., $39.95

ISBN 978-1-59327-391-0
full color, hardcover

Image

The Unofficial LEGO® Builder’s Guide, 2nd Edition

by ALLAN BEDFORD

NOVEMBER 2012, 240 PP., $24.95

ISBN 978-1-59327-441-2
full color

Image

The LEGO® Adventure Book, Vol. 1: Cars, Castles, Dinosaurs & More!

by MEGAN ROTHROCK

NOVEMBER 2012, 200 PP., $24.95

ISBN 978-1-59327-442-9
full color, hardcover

PHONE:
800.420.7240 OR
415.863.9900

EMAIL: [email protected]

WEB: WWW.NOSTARCH.COM

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.140.198.173