Presentation on theme: "Robotics Catchup/Review: switch, arithmetic, range, loop Bluetooth Lab: Finish parallel parking. Next: Use Bluetooth communication for calculate & send."— Presentation transcript:
Robotics Catchup/Review: switch, arithmetic, range, loop Bluetooth Lab: Finish parallel parking. Next: Use Bluetooth communication for calculate & send location exercise.
Review NXT-G Switch block Arithmetic block –Two operands or operand & constant Range –Inside or outside –Data wires or constants Loop –Infinite, counter, logic
More NXT-G Check out the random block to produce random number: Complete palette, DICE icon, you can set min and max (or use data wires to set min and max) Consider using sound and then display to show the random number and make sure you include a wait (time or button push) so you can see it!
Bluetooth Master / slave(s) Need to turn off / stop PC to NXT Master sets up connection –Done using the NXT brick Prior to running programs Start off with seach/scan for devices Choose connection number 1, 2, 3 Password exchange Slave NXTs will refer to Master as 0 Slave NXTs communicate ONLY WITH THE MASTER NXT.
"Relay" message system For 3-robot relay, make the master the middle robot on the team. –Robot A starts. Sends message to master using connection 0 –Robot B, the master, receives the message. Then sends message to Robot C using 1 or 2. For 4-robot relay, set up Robot B (master) to wait for messages on 2 mailboxes (use parallel beams), when it receives a message from Robot C, it sends a message to Robot D.
Connection procedure Turn on both NXT bricks On master, use buttons to get to Bluetooth search (magnifier with bluetooth symbol) –Will say searching … and then stop, will have symbols for found Bluetooth devices. OTHER NXT BRICKS WILL APPEAR BY NAME –Click on the specific brick to make connection Click again on number (1, 2, or 3). Symbol with name will now show up at number. ON OTHER BRICK, go to Bluetooth connections. The master should show up as 0. –NOTE: first time (and maybe other times), there will be request for password: DON’T CHANGE FROM 1234
Bluetooth send Sends message to –Connection number 0, 1, 2, 3 Think of this as address –Mailbox 10 mailboxes, Each can hold 5 messages. Oldest gets erased if/when 6 th message sent. Message is specific data type –Text, number, logic
Bluetooth receive Receive block does NOT specify connection! This NXT bricks receives at/on its own address. Receive block does specify mailbox Prior agreement on the datatype expected. Use receive message block in loop –Can output message using appropriate data wire hub. If you know what a message will be, can use Wait for specific message in mailbox