How to program an nxt brick




















Now both of them have their Bluetooth enabled. This is indicated by this icon. And now I'll go to the search menu of the "Favorit" brick because it will be the master brick. There I will search for the slave brick - in our case "". Now we wait until it finds the other brick.

It has found , so I'll select it. Then I select Port 1. I want to establish connection between the two bricks on Port 1. Now the two bricks are paired and ready to communicate. I go to My Files and start the programs in order to check how they work.

As you see, the program works perfectly. Now I'll turn off the bricks and then start them once again. Once I have paired the two bricks, all I need to do now is to go to the Bluetooth menu of the master brick and then to My Contacts and select the slave brick in our case Select Connect and again select Port 1. The two bricks are now connected, so I can run the program.

In the end, I will run the program once again in order to be sure that everything is just fine. The program is working properly. In this tutorial we have used Bluetooth communication with two bricks only. But the Mindstorms series can communicate with up to five bricks. So, in one of the next tutorials I'll show you how you can establish Bluetooth connection with more than two bricks. NXT-G source code of the program for the master brick.

English In this tutorial we'll get familiar with the basics of the Bluetooth communication using the Mindstorms NXT brick. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Learn more. Asked 9 years, 2 months ago. Active 7 years, 6 months ago. Viewed 6k times. Improve this question. HaydenStudios 2, 5 5 gold badges 25 25 silver badges 44 44 bronze badges.

Not directly or even officially. We can now substitute 2 into 3 so that the voltage between the black and white wires is determined by the angle of the potentiometer rather than its resistance. Then we can substitute the result into 1 to get an equation for the RAW value. For my potentiometer, I find that a maximum angle of gives me a maximum value of This is less than 7 bits of information, and each RAW value corresponds to.

If you want a nice angle detector, you will probably need a potentiometer! Before beginning, you need to cut and strip one of the NXT cables so that you can interface with the wires directly. I have placed a layer of solder on mine, so they can be inserted into a breadboard for easy connecting. For example, if you want to run the robot over a different colored surface or the room lighting changes , you would simply have to re-calibrate the sensor before running the same line follower program on the new surface.

There are two ways to calibrate the light sensor: using the method built in to the NXT programming software, or using a somewhat friendlier calibration program provided below. At this point the software will download a program called "Calibrate" to the NXT and run it. Place your robot over the surface to be used and use the screen prompts to sample the two values see Taking the Two Calibration Readings below.

A similar but somewhat friendlier calibration program is provided here:. The Calibrate 3 program will prompt you to sample two light readings for a light sensor on port 3, one for "Black" and one for "White" see Taking the Two Calibration Readings below. Note that "White" just means the lightest part of the surface being run on.

If your surface is tan colored, for example, just sample that for "White" and similar for "Black". The program then follows up with a test of light readings that continuously reports the calibrated brightness seen, so that you can easily see and verify the results of your calibration after calibration, "Black" should report very close to 0 and "White" very close to The View Light 3 program can be used as a measurement tool to simply display the calibrated light readings currently seen by a light sensor on port 3.

This is useful because the built-in "View Reflected Light" feature of the NXT reports uncalibrated readings and will therefore not match the values you want to use in your programs. The Del Calibrate program will delete the stored light sensor calibration from the NXT's memory and restore the "uncalibrated" state, in case you want to use that or experiment with the difference. Taking the Two Calibration Readings Using either the built-in NXT Calibrate program, or the Calibrate 3 program provided above, you will use the on-screen prompts to sample two light readings, with the robot on the actual surface to be used and the sensor in its actual position on the robot.

When prompted to sample the "Min" or "Black" reading, position the sensor so that the red spot is centered over the line and then press the Enter button on the NXT. When prompted to sample the "Max" or "White" reading, position the sensor so that the red spot is completely over the surface away from the line and press the Enter button on the NXT. When line following, the robot will try to align itself centered over the boundary between white and black not centered over the black line , with black to the robot's left.

What do you think will happen to the robot when it gets there? Does it depend on which direction around the track it is going? Does the same thing happen every time? The line following programs provided here use the motors at only about half power, in order to stay in control and not miss the turns in the test track. If it goes too fast, the robot may cross over to the other side of the black line and get confused.

Thinking about how the program works, can you explain why this confuses it? What will happen afterwards? The LineFollow5 program breaks the driving and steering into five different conditions, depending on how far away from the color boundary the robot thinks it is.



0コメント

  • 1000 / 1000