Sending, Receiving and Processing Messages NQC Tutorial pp'3436 - PowerPoint PPT Presentation

1 / 6
About This Presentation
Title:

Sending, Receiving and Processing Messages NQC Tutorial pp'3436

Description:

At that time it should acknowledge receipt of the message by tone sounding. That is, if the destination is 4, sound a tone 4 times. ... – PowerPoint PPT presentation

Number of Views:41
Avg rating:3.0/5.0
Slides: 7
Provided by: DonaldFa1
Category:

less

Transcript and Presenter's Notes

Title: Sending, Receiving and Processing Messages NQC Tutorial pp'3436


1
Sending, Receiving and Processing MessagesNQC
Tutorial pp.34-36
2
Sending and Receiving Messages
  • A robot can use the command SendMessage() to send
    a value (0-255) over the infra-red port. All
    other robots receive this message and store it.
  • The program in a robot can ask for the value of
    the last message received using Message(). Based
    on this value the program can make the robot
    perform certain actions.

3
Master and Slave
  • Two cooperating robots can interact
  • Master-- sends a message
  • Slave-- responds to the message
  • In the following example we will develop a
    communication protocol in which we define three
    messages
  • 1 go forward,
  • 2 go backward, and
  • 3 stop.

4
task main() // SLAVE while (true) ClearMes
sage() until (Message() ! 0) if (Message()
1) OnFwd(OUT_AOUT_C) if (Message() 2)
OnRev(OUT_AOUT_C) if (Message() 3)
Off(OUT_AOUT_C)
task main() // MASTER SendMessage(1)
Wait(200) SendMessage(2) Wait(200) SendMessag
e(3)
5
Messaging Protocol for Nursebot
The message will represent the destination for
nursebot.
4
5
6
start
1
2
3
6
  • When your nursebot is started, it should remain
    stationary at the starting point until it
    receives a message detailing the destination.
  • At that time it should acknowledge receipt of the
    message by tone sounding. That is, if the
    destination is 4, sound a tone 4 times. (Hints
    use a repeat loop and dont forget to add a
    delay.)
Write a Comment
User Comments (0)
About PowerShow.com