|
Re: Program does not end
While loops are tricky in robotics programming because only the code section within the loop runs until it is broken. Since the sensors are read outside of the loop itself, the loop is infinite.
Another implementation might be like this:
'pseudocode'
if (l teeth < 4 || r teeth < 4)
{
run motors;
}
else
{
motors = 127;
}
The question I ask is if the code is meant to turn the robot, why would the left and right sides both count similarly? Are they on the same gear as a redundancy check? The real question I ask is are the sensors on the robot so one is on each side of the robot, or are they positioned differently?
__________________
Alumni
Team #217, The ThunderChickens
Student, Class of 2009
California Institute of Technology
|