||NXT, master, worker, simple, remote control car, soccer, maze, navigation, battlebots
||Bluetooth connectivity in the NXT will bring surefire excitement into your classroom. However, there are a lot of (albeit simple) steps involved in making a connection. Be prepared for varying levels of difficulty across groups.
Groups that achieve connectivity early can work on making their remote controls more complex and sophisticated. Work to achieve connectivity before helping groups with involved programming questions.
Bluetooth – a standard for the short range wireless interconnection of electronic devices.
Master – Device in a communication relationship that sends commands.
Worker – Device in a communication relationship that receives and executes commands.
||(1) Students must give their NXT a unique name. This is done by clicking on the NXT window button (located above the download and run button), replacing the name on the right hand side of the pop up window and pressing the enter button next to the name. Make sure the new name remains in the slot.
(2) Turn Bluetooth on on both of the NXT’s. This is done by scrolling over to bluetooth, clicking “turn on/off” and selecting on. The NXT should display the bluetooth symbol with a “<” next to it.
(3) One NXT should “search” for the other. In the bluetooth menu, select ‘search.’ The NXT will display a status bar while it scans electronic devices. A list will come up listing all closeby computers, phones, and NXT’s. Scroll to the NXT you want to connect to and select it.
(4) Choose a connection port. The NXT can connect to multiple devices. Connect to any port.
(5) Enter passkey. The passkey is 1234. If you successfully connected, both NXT’s should have a “<>” symbol next to the bluetooth symbol.
Programming the Master
The master will send messages using the “send message” command. For controlling a car with a continuous sensor value (rotation, light, sound, distance), you will be sending a number. Select your connection port, change message type to number. Finally, assign a mailbox for your command. Every command should have its own unique mailbox. (For example, the rotation sensor on the master will be controlling the power of the motors on the worker, while the NXT buttons will be controlling the steering. The rotation sensor message should get its own mailbox, and each NXT button should get its own mailbox, but they should all have the same connection number) To control the worker using buttons (NXT buttons and touch sensors), you will be sending logic. So switch the message type to logic and wire from the logic output of the sensor. The program should be in a loop to check for and send commands continuously.
Programming the Worker
The worker uses the “receive message” command. Choose the mailbox and the message type, and use the wiring tool to use the information to send commands. If the message type is a number, you can wire it directly into the output you want to control. If its logic, you need to use it with a switch.