Advertisement
Guest User

Untitled

a guest
Mar 24th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. void semiCircle(double radius) {
  2. double ratio, radius1, radius2, RPM, RPM1;
  3. double rev1, rev2;
  4. radius1 = radius + 5;
  5. radius2 = radius - 5;
  6. ratio = radius2 / radius1;
  7. RPM1 = target_RPM;
  8. RPM = ratio * RPM1;
  9. /*
  10. rev1 = (PI*radius1 / (2.0*5.7)) * 49.0;
  11. rev2 = (PI*radius2 / (2.0*5.7)) * 49.0;
  12. */
  13. rev1 = (2.0*PI*radius1 / (PI*5.7))*49.0;
  14. rev2 = (2.0*PI*radius2 / (PI*5.7)) *49.0;
  15.  
  16. int y = (int)rev1;
  17. int y1 = (int)rev2;
  18. output = PID.ComputePID_output(RPM, current_RPM);
  19. output1 = PID1.ComputePID_output(RPM1, current_RPM1);
  20. motor.set_speed(output);
  21. motor1.set_speed(output1);
  22.  
  23. Serial.println(sense.GetDistanceCount());
  24. if (sense.check_distance_met(y1)) {
  25. motor.stopMotor();
  26. motor1.stopMotor();
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement