Download presentation
Presentation is loading. Please wait.
Published byKellen Happe Modified over 10 years ago
1
EducateNXT Follow the Leader Using Bluetooth communication, one robot can be made to follow the actions of a second robot. Features in this presentation: Bluetooth communications (Send Message block, Receive Message block) Random behaviors (Random block) Wiring blocks together using Data hubs
2
EducateNXT Name the two robots Select names for the two robots being used. Robot 1 _______________________ Robot 2 _______________________ These names can be added to the brick as follows:
3
EducateNXT Name the two robots Enter name here Click the Button straight after the name is typed in. Name will appear on the NXT brick screen.
4
EducateNXT Plan the actions for the robots ActionBlock(s) required 1. (e.g. “Turn left for 1 second”) (e.g. “Move block”) 2. (e.g. “Go forward 2 rotations”) (e.g. “Move block”) Copy and fill out the table:
5
EducateNXT Program and randomize the actions Two programs are required: Leader and Follower Leader program Program randomly selects one of the two actions (e.g., forward for 1 rotation) Follower program Copies the action of the Leader Receives Bluetooth message Sends action via Bluetooth Animation in progress
6
EducateNXT Program and randomize the actions Start a new program Leader’s program first or Program starts with a Loop as the leader will need to keep creating steps indefinitely.
7
EducateNXT Program and randomize the actions The leader will perform one of their two actions randomly. A Random block will be required from the Complete palette. The Random block is dragged into the loop. Minimum is set to 0. Maximum is set to 1.
8
EducateNXT Program and randomize the actions A Switch is added (from either the Common or Complete palettes). Control = Value Type = Number In the Switch configuration panel:
9
EducateNXT Program and randomize the actions Wire from the Random Block to the switch As in the above animation – use left mouse click to change direction. … And one more time. Animation in progress
10
EducateNXT Program and randomize the actions Place the actions you wrote down into the switch.
11
EducateNXT Sending a message via Bluetooth Select and drag the Send Message icon into the Leader program. Leave both the Connection and Mailbox in the Configuration panel set at 1.
12
EducateNXT Sending a message via Bluetooth Open the Send Message block’s data hub by clicking on the bottom- left of the block (as shown).
13
EducateNXT Sending a message via Bluetooth Draw out another wire from the Random block. Wire to the Number Plug on the Send Message block.
14
EducateNXT That is the finished Leader’s Program. This can be downloaded to the Leader’s brick. Don’t run it yet. The Follower needs to be programmed.
15
EducateNXT Programming the Follower 0 1 What action? Wait for a Bluetooth message Do action 1 Do action 0 A flowchart of the Follower’s program
16
EducateNXT Programming the Follower Drag a Receive Message Block into a Loop. The loop means it will continually allow the Follower to look for a Bluetooth message before acting on it. Set the loop to Control = Logic and Until = True
17
EducateNXT Programming the Follower Set the Message to Number. Wire from the “Message Received” data hub point to the “Loop Condition” as shown. Once a message is received the program will now break out of the loop.
18
EducateNXT Programming the Follower Add a switch block set to Value. Wire from Number Out to the Switch. And add the action blocks you used in the Leader’s program. Download this program to the Follower’s brick. Animation in progress
19
EducateNXT Connecting the bricks Before the two programs can be run, a Bluetooth connection needs to be established between the two bricks. To do this you will need to access the “Educate NXT” PowerPoint called Establishing a Bluetooth Connection Leader = MasterFollower = Slave
20
EducateNXT Happy Following! Once the Bluetooth connection has been established, run both programs at the same time.
21
EducateNXT
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.