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
|
|
|
|