3-26-2015 DSV
Fork of scanner by
Diff: scanner.cpp
- Revision:
- 5:4d5601a9dffe
- Parent:
- 4:6a8d80954323
- Child:
- 6:5e24ff86b743
--- a/scanner.cpp Tue Mar 22 03:00:16 2016 +0000 +++ b/scanner.cpp Tue Mar 22 18:11:36 2016 +0000 @@ -114,14 +114,14 @@ servoL.write(DUTY[dutyL]); servoR.write(DUTY[dutyR]); wait(0.1); - /* distLeft = longRangL.read(); - distRight = longRangeR.read(); */ + distLeft = longRangeL.distInchesL(); + distRight = longRangeR.distInchesR(); dutyL = HALF_DUTY; dutyR = HALF_DUTY; servoL.write(DUTY[dutyL]); servoR.write(DUTY[dutyR]); wait(0.1); - /* distForward = ( longRangeL.read() + longRangeR.read() )/2.0 */ + distForward = ( longRangeL.distInchesL() + longRangeR.distInchesR() )/2.0; pitEnable = 1; } @@ -141,10 +141,20 @@ if (pitEnable == 1) { // obtain distance measures from sensors + distLeft = longRangeL.distInchesL(); + distRight = longRangeR.distInchesR(); + // check avoid flag - // add obstacle avoid code + if (avoidFlag == 1) + { + // add obstacle avoid code + } + // check hunt flag - // add hunt code + else if (huntFlag == 1) + { + // add hunt code + } // increment/decrement servo position dutyL += invertL;