To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 398
397  |  399
Subject: 
RE: Help with my IR tower
Newsgroups: 
lugnet.robotics
Date: 
Tue, 10 Nov 1998 16:52:39 GMT
Original-From: 
Paul Haas <PAULH@stopspammersHAMJUDO.COM>
Viewed: 
2445 times
  
On Tue, 10 Nov 1998, Tom Pierce wrote:

By the way -- anyone else have trouble using RCX IR messages in NQC? I've
been unsuccessful in getting SendMessage() to work. Thanks all.

It took me a few tries to Message() and ClearMessage() to do what I
wanted.  At first I was clearing messages too often or not often enough.

Here are a few lines of nqc code that work for me:

int msg;

task msgWatch {
    while(true) {
        msg = Message();
        if ( msg != 0 ) {
            ClearMessage();
            if ( msg == 1 ) {
                stop randomWalk;
                Off(RIGHT + LEFT);
                SendMessage(3);
            } else if ( msg == 2 ) {
                start randomWalk;
                SendMessage(4);
            }
        }
    }
}

Task main starts msgWatch, and there is another task called randomWalk.
The msgWatch task loops looking for interesting messages.  It acknowledges
with another message, each message that it acts on.  Thus the other system
can retry until the RCX responds.  It ignores all other messages.  Later
versions of this code have more "} else if ( msg =="  lines, but that
would just make this message longer.

--
paulh@hamjudo.com  http://www.hamjudo.com
The April 97 WebSight magazine describes me as "(presumably) normal".



Message is in Reply To:
  RE: Help with my IR tower
 
Jeff -- I've hit the same issue with my tower. It starts off working fine, but after around 5 or so minutes, it stops responding (and the old 'IR Transmitter needs batteries or is in direct sunlight' message comes up). I spent a couple of hours (...) (26 years ago, 10-Nov-98, to lugnet.robotics)

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