Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void straight_and_reverse(int target_distance_fwd, int target_distance_bwd)
- {
- if (checkDistanceMet(target_distance) & car_reversed == 0)
- {
- if (time_interval1*check_intervals_passed >= 1000)
- {
- motor.change_direction();
- motor1.change_direction();
- car_reverse = 1;
- }
- else
- {
- check_intervals_passed++;
- motor.stopMotor();
- motor1.stopMotor();
- }
- }
- else if (checkDistanceMet(target_distance_bwd) & car_reversed == 1)
- {
- motor.stopMotor();
- motor1.stopMotor();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement