bluetooth communication module 3. warm up swq: 30 – oct. – 2013 give examples where bluetooth...

Post on 03-Jan-2016

216 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Bluetooth Communication

Module 3

Warm Up

• SWQ: 30 – Oct. – 2013

• Give examples where Bluetooth technology is used

• What is the range for the Bluetooth ?

NXT and Bluetooth

Search for projects that uses Bluetooth in the NXT

What blocks I need to build Bluetooth

communication between two NXT ??

Send message block: send a wireless message to another NXT

Receive message block: receive a wireless message from another NXT

Send Message Block

The send message block can be configured using either the configuration panel or using data wires

Connection

Mail Box

text I will send

Number I will send

logic I will send

X = -2 -2

AhmedX = Ahmed

X = 1 1

How can I send the measured sound

level ?

Send Message BlockConnection Connection section is used to identify the connection

number of the target NXT (the NXT that will receive the message). It is a value between 0 and 3.

Message Includes: • message type (logic, number or text)• message content.

Mailbox Each NXT brick has 10 mailbox numbers where wirelessmessages can be stored.

Each mailbox number can hold up to five messages.

Receive Message Block

Mail Box number The test textThe test Number The test logicMessage received (yes/N0)If the test message and received message the same, output is TrueThe received textThe received Number The received logic

The receive message block can be configured using either the configuration panel or using data wires

Receive Message BlockMessage: The message section allows you to select the type of

message being received (logic, number or text).

Compare to: If you want to compare the incoming message with a test message, either type the test text or number or use the radio buttons to choose the logic test value (True or False).

If the test message and the received message are the same, the Yes/No data wire will return a value of “1”; otherwise, it will return a value of “0”.

Mailbox: The mailbox identifies the receiver’s mailbox where the sent message will be stored.

Why do I need to compare between the test message and the received message ?

Correct Communication

• Connection Number on the computer and the chosen one on the NXT must be the same

• Mail box of the transmitter and the receiver must be the same

LAB ACTIVITY 1:

– Step 1: Turn on Bluetooth on both NXT

– Step 2: Rename the NXTs (TX# and RX#)

– Step 3: SEARCH for RX# on the TX# NXT

<> (connection is made)

• Step 5: Receiver Program

• Step 6: Run the program on the receiver first

LAB ACTIVITY 1: (Page 11)

,

Why ??

• Step 4: Sender Program

Worksheet

Connection Number: Mail box Number:Sent massage: Data type of the sent massage:

Connection Number: Mail box Number:Sent massage: Data type of the sent massage:

Connection Number: Mail box Number:Sent massage: Data type of the sent massage:

Connection Number: Mail box Number:Sent massage: Data type of the sent massage:

Review Exercise – Page 17

• Sender Program:• The sender unit will read the sound level• The sender will display the sound level values on its

screen and send them wirelessly to a receiver unit

• Receiver Program:• The receiver unit will receive the sound level values.• If the sound level values are more than 50%, the

receiver unit will move forward; otherwise, it will stop moving.

LAB ACTIVITY 2:Remote Control Program

LAB ACTIVITY 2: Car Program

This looks confusing ??!!

Read it step by step, it will be

easy

Recap

Conclusion

• Send massage block • Receive massage block • Set up the Bluetooth on both NXTs• Sender program• Receiver Program

top related