| Description | 
This code runs motors B and C until they stall.
The code takes two rotation sensor readings, with a very short delay in
between them. The loop exits when the difference between the two readings
becomes less than a certain threshold. So if a motor slows down because
it encounters an obstacle, the code will stop running the motors. A short delay in
the beginning is necessary so that the motor can start moving before the rotation sensors start taking readings. Note that if the speed of the motor is decreased, the threshold for the difference needs to be lowered as well. This program was adapted from
Brian Davis' code. |