Subject:
|
Re: Yet another Q: IR messages
|
Newsgroups:
|
lugnet.robotics.rcx.nqc
|
Date:
|
Thu, 29 Mar 2001 17:25:08 GMT
|
Viewed:
|
2339 times
|
| |
| |
Hi Tobias,
this could look something like this for example :
int global_message; // place to store and read messages for every task
task main()
{
start Read_Messages; // start Receive_Message Task
while(true)
{
switch (global_message)
{
case 1 : SendMessage (100); // Sends message 100 via IR port
break;
case 100 : do_something();
break;
case 255 : .....................
........
default : do_default_stuff();
break;
}
}
task Read_Messages ()
{
int local_message = 0;
ClearMessage(); // Cleares receive buffer
while (true) // leaves at end of world (or batteries down)
{
while (!local_message) // leaves only if message received
{
local_message = Message(); // stores message local
Wait(10); //don't know if neccessary ? Try out !
}
ClearMessage(); // Cleares receive buffer
global_message = local_message; // stores message global
local_message = 0; // reset local_message for receiving next
}
}
Rainer
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 (...) (24 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
|
|
|
|