Send/Receive Messages from NXT brick – this part taken from RobotC manual, for more information see:
The NXT firmware automatically receives messages and adds them to a queue of incoming messages. The application program takes the messages from this queue and processes them one at a time. The variables message and messageParm contain the contents of the current message being processed. The function ClearMessage discards the current message and sets up to process the next message.
Example can be found in 'BtBasicMsg.c'
Other simple methods:
cCmdMessageGetSize get the size of the first message in a mailbox containing a queue of received messages. cCmdMessageRead removes the first message from a mailbox queue and copies it to a user buffer. Implementation requires checking for messages periodically and read any incoming messages using cCmdMessageRead. Then interpretate this message and translate it into instructions.
Example can be found in ‘NXT BT Messaging No Error Checking.c'
For Pc-side code, see implementation below in Visual Basic for details.