Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool isStall(float count) {
- bool leftStall = false;
- bool rightStall = false;
- int leftStartCount = left_encoder.Counts();
- int rightStartCount = right_encoder.Counts();
- //Wait 500 ms to reread encoder counts
- float start = TimeNow();
- while (TimeNow() - start < 0.3) {
- if (right_encoder.Counts() > count) {
- return false;
- }
- }
- int leftEndCount = left_encoder.Counts();
- int rightEndCount = right_encoder.Counts();
- if (rightEndCount - rightStartCount < 5) {
- rightStall = true;
- LCD.WriteRC("!!!-----R STALL------!!!",9,1);
- }
- if (leftEndCount - leftStartCount < 5) {
- leftStall = true;
- LCD.WriteRC("!!!-----L STALL------!!!",10,1);
- }
- return leftStall && rightStall;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement