|
In lugnet.robotics.rcx.legos, Robert Templeton writes:
Nothing like talking to yourself :), but I did finally find the problem and
it is in the code. It isn't always what's there, but what's not. Here's
the offending section:
> //*** Move Forward ***
> void moveForward(unsigned char speed)
> {
> motor_a_speed(speed);
> motor_a_dir(fwd);
> motor_b_dir(off);
> }
Instead of varying the speed, I had been varying the distance with this
function wrapper:
void forward(unsigned int distance)
{
distance <<= 2;
moveForward(MAX_SPEED);
while(DISPLACEMENT < distance);
//*******************
stopMotion();
resetTurnDetector();
//********************
}
When I switched to speed variance, I figured I didn't need all of that
"useless" code in the forward() function. Wrong!!! The lack of those two
comment-surrounded lines is the cause of the problem.
Say "Goodnight, Gracie."
Goodnight, Gracie...
D'oh!
Robert Templeton
|
|
Message is in Reply To:
| | Strange behavior
|
| This code was working last night, but I removed some superfluous functions copied with the set (such as moveBackward() and pivotRight()) since they were not being used. All of a sudden, the robot turns okay, but never moves forward. It just sits (...) (23 years ago, 28-Jan-02, to lugnet.robotics.rcx.legos)
|
2 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|