To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.nqcOpen lugnet.robotics.rcx.nqc in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / NQC / 1044
1043  |  1045
Subject: 
Re: Yet another Q: IR messages
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Thu, 29 Mar 2001 17:25:40 GMT
Viewed: 
2225 times
  
To send a message use the following:

SendMessage(<variable> or <number>);

The variable must be of integer type between 1 - 255
The number must be between 1 - 255

To read a message from the IR port do
<variable> = Message();

This will put whatever number is in the message buffer into your <variable>


As to what to decided to send and get this depends on your code.  Here is a
simple example.  You have 2 RCX. RCXA and RCXB  A will always send and B
will always recieved and respond via a light output.

code for RCXA (Note I am typing this out of the top of my head and have not
run it yet... also not going to show all the code (initaliazation, etc.)

TurnLight = 1;  // Let RCX B know to turn on output 1 (Motor/Light on A)
SendMessage(TurnLight);

Wait(100);
TurnLight = 2; // Let RCX B know to turn on output 2
SendMessage(TurnLight);
...


For RCXB

while (true)
{
   if (Message() == 1) // Got a message 1 in your buffer so turn on motor A
   {
     Off(OUT_A+OUT_B+OUT_C);
     OnFwd(OUT_A);
   }
   elseif (Message() == 2)
.
.
.
}


In lugnet.robotics.rcx.nqc, Tobias Möller writes:
I can't figure out how to use the IR commands. I've tried, read a bit in
the documentation, but still have no clue.

I'd like to know how to:

a) Send a message (and decide what message it should be)

and

b) learn how to recieve messages

Thanks in advance.

--Tobias



Message is in Reply To:
  Yet another Q: IR messages
 
I can't figure out how to use the IR commands. I've tried, read a bit in the documentation, but still have no clue. I'd like to know how to: a) Send a message (and decide what message it should be) and b) learn how to recieve messages Thanks in (...) (23 years ago, 29-Mar-01, to lugnet.robotics.rcx.nqc)

6 Messages in This Thread:




Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR