To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.org.us.laflrcOpen lugnet.org.us.laflrc in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Organizations / United States / LafLRC / 93
92  |  94
Subject: 
#define-ing stuff for Chibots
Newsgroups: 
lugnet.org.us.laflrc
Date: 
Mon, 3 Oct 2005 18:21:23 GMT
Viewed: 
643 times
  
Talking about Chibots Maze event, Davis, Brian L. wrote:

   Oh, and of course the real kicker for event day - I'm developing on a black maze
on white background, flagging everything that should matter to make a "negative
copy" of the software for later. Ugh.

I'm not totally sure about this, but try playing around with #define

In one language I use, the compiler will totally take out the variable, and put in
the defined value, before compiling the program.  I assume that's how it should work
in C and NQC.

So, you can do this:


---
#define UseColor    >
// '>' is black line
// '<' is white line

...

if (s1 UseColor threshold1)
{
  // s1 is on line
}
else
{
  // s1 is off line
}
----

   What is the maximum incline in the advanced maze? I've got the sensor head
pivoting now, and I think ground clearence will be OK, but we'll see.

For Chibots advanced line, they usually have a hump that's about 2 inches high, in
the middle, and 6 to 8 inches long.

Steve



Message has 2 Replies:
  Re: #define-ing stuff for Chibots
 
(...) I have, and it helps a lot. For instance, when comparing the raw light sensor values to some limit, I #define "<" to be "LIGHTER_THAN", for instance. That makes switching all those points very easy in the code, I need only change two #defines (...) (19 years ago, 3-Oct-05, to lugnet.org.us.laflrc)
  Re: #define-ing stuff for Chibots
 
(...) Or a different way #define BLACKLINE 1 #if BLACKLINE #define SEELINE(reading,threshold) reading < threshold #else #define SEELINE(reading,threshold) reading > threshold #endif if (SEELINE(s1,threshold1)) { // s1 is on the line } else { // s1 (...) (19 years ago, 8-Oct-05, to lugnet.org.us.laflrc)

3 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