Dependents: MouseHybridSenseCode
Diff: findLineFunc.cpp
- Revision:
- 5:dfea493f7a12
- Child:
- 6:a652deaae134
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/findLineFunc.cpp Sun Mar 11 13:15:34 2018 +0000 @@ -0,0 +1,18 @@ +#include <mbed.h> +#include <funcdef.h> + +void findLineFunc() +{ + //TURN RIGHT UNTIL SENSOR A6, POSITION 6, BEATS THERSHOLD + while (((sensorPin[6]).read_u16()>>4) < (sensorThreshold[6])) + { + //LEFT WHEEL STARTS TURN + leftMotorVal.pulsewidth_us(300); + rightMotorVal.pulsewidth_us(0); + } + //CONTINUE FOR A BIT, THEN STOP MOTORS AND RETURN + wait_ms(100); + leftMotorVal.pulsewidth_us(0); + rightMotorVal.pulsewidth_us(0); + return; +} \ No newline at end of file