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 / 9501
9500  |  9502
Subject: 
Newbie Question - Programming the Scout
Newsgroups: 
lugnet.robotics
Date: 
Wed, 29 Dec 1999 14:57:27 GMT
Original-From: 
Jeff Buckey <jbuckey@earthlink.[Spamcake]net>
Viewed: 
835 times
  
Hello all,

I'm new to this list and to Lego Robotics as I just received my first Lego
Discovery Kit for my birthday a couple of weeks ago.  When I learned that I
could buy an IR tower to allow the Scout to communicate with my PC so I
could write my own little "programs" to control the Scout I was very
excited, to say the least.  I immediately got out the credit card and orderd
the IR tower.  I received it yesterday and was "playing" trying to learn the
assembler language that the ScoutTool and ScoutSDK describe, when I came to
a small roadblock.  Which brings me to my question.  Forgive me for asking
such a simple question, but I'm not sure where to go from here.

I want to write a program that will move my robot around until it runs into
something.  I'm thinking of making it "pace" as if it was guarding
something.  I've written the code to make it "pace", but I also wanted it to
"listen" for events from the touch sensors, so if it detects an object in
it's way it will back up, turn the power to 7 and then ram whatever is in
it's way.  As I said I've got the code written to make the robot pace, but
the event listening is giving me some trouble.  In the Scout SDK it seems
the opcode I want is "mone" which will interrupt the current task and jump
to another section (a label) if an event is triggered.  The SDK doesn't
really give any good examples of how to use this command (opcode) and I'm
not sure what to pass it as a parameter.  It is supposed to take three
parameters so it looks like this:
mone src, var, label - with src being either constant, variable or random
and label being the label to jump to when the event is triggered.  The one
I'm confused about is the var parameter.  I want mone to listen for the
"pressed" events from the touch sensors.  There is a table of the 15 events
that are possible with the scout, and they are listed as hex numbers.
Should I AND the hex values (or their binary equivalents) for TOUCH1 and
TOUCH2 together (using a #define maybe?) and then use that as the second
parameter?  Something like:
#define SEN_BOTH_MOTORS 0x0001 & 0x0004
mone SRC_CON, SEN_BOTH_MOTORS, GoHere

Should that work?  Any examples would be great, I think the one thing that
the Scout SDK is lacking so far is really good practicle examples.  There
are a few, but not enough for my taste.  I'd be interested if anyone has
found some good web sites or other useful information on programming the
Scout also.

Thanks in advance,
-Jeff Buckey



Message has 1 Reply:
  Re: Newbie Question - Programming the Scout
 
(...) ScoutDef.h is heavily commented and should make it a little clearer. Look at the EVENT_* defines. (...) First you mean OR, not AND. Those are the right numbers (EVENT_T1PR and EVENT_T2PR). You could use EVENT_T1PR | EVENT_T2PR, or you could (...) (25 years ago, 30-Dec-99, to lugnet.robotics)

2 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    
Active threads in Robotics

 
Verified and Trusted Team of Hackers
5 hours ago
Custom Search

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