Subject:
|
Re: Sending/receiving messages
|
Newsgroups:
|
lugnet.robotics.spybotics
|
Date:
|
Wed, 12 Jan 2005 02:35:43 GMT
|
Viewed:
|
7446 times
|
| |
| |
In lugnet.robotics.spybotics, Steve Hassenplug wrote:
> SendMessage(SORT_NUMBER);
> while (Message()!=SORT_CONFIRM);
> start follow_line();
Unfortunately, the Spybot does not support the Message() or SendMessage(n)
functions. The RCX mailbox source (which is what is read or written to via
these functions) is the VLL source in the Spybot. You can, however, use other
functions to communicate back and forth between multiple Spybots.
Here's an extract from the NQC Guide regarding SendSpybotMessage and RxMessage:
SendSpybotMessage(nIndex, nCmd, nHiByte, nLoByte) Function - Spy
Built-in ROM subroutine number 34. This subroutine sends a message to a Spybot.
If nIndex is a controller or PC then it does nothing. nIndex is the index of
the Spybot in the world relation table (0-15), INDEX_LINKCAST, or
INDEX_BROADCAST.
SendSpybotMessage(INDEX_LINKCAST, 50, 0, 10);
RxMessage(channel, byte) Value - Spy
Read the contents of a received IR or PC message (4 bytes total). The desired
channel is MSG_IR or MSG_PC. The desired byte is specified using MSG_INDEX,
MSG_COMMAND, MSG_HI_BYTE, or MSG_LO_BYTE.
if (RxMessage(MSG_IR, MSG_COMMAND) == COMMAND_CONTROLLER)
{
x = RxMessage(MSG_IR, MSG_HI_BYTE);
}
Hope this helps,
John Hansen
|
|
Message is in Reply To:
| | Re: Sending/receiving messages
|
| Gabe, I think you want something like this: // first spybot if (x==1) { SendMessage(SORT_NUMBER); while (Message()!=SORT_CONFIRM); start follow_line(); } --- // second spybot if (Message()==SORT_NUMBER) { //send confirmation (...) (20 years ago, 11-Jan-05, to lugnet.robotics.spybotics)
|
3 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|