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 / 12965
12964  |  12966
Subject: 
const int syntax
Newsgroups: 
lugnet.robotics
Date: 
Sun, 29 Oct 2000 17:05:45 GMT
Viewed: 
839 times
  
I cannot seem to find the right syntax for const int in NQC.  For example,
in trying to synchronize LEFTLEGS and RIGHTLEGS in a 6-leg robot, this piece
of code does *not* work:

int count;  //declare a variable 'count'
count = 0;  //initialize 'count' to zero
task synch()
{
    while (true)
    {
        if (count << 0)  //  requires a constant
        {
            Off (RIGHTLEGS);
            Wait (10);
            On (RIGHTLEGS);
        }
        if (count >> 0)  //requires a constant
        {
            Off (LEFTLEGS);
            Wait (10);
            On (LEFTLEGS);
        }
    }
}
According to Dave Baum's wonderful book, 'const int' can be used in such a
case.  On page 53 he uses it as an argument in a linear function, but I
cannot find an example on its own.

I have tried:

const int count;  //parse error
const int count   //parse error
const int count();//parse error
const int count() //parse error

So I might have a total misconception of how variables and constants work!
Can someone help?

Jerry



1 Message 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
12 hours ago
Custom Search

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