Advertisement
Guest User

EMECServoCntrl

a guest
Feb 19th, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1.  
  2. int withinBoundsCounter = 0
  3. int cycleCounter = 0;
  4.  
  5. cycleCounter++;
  6. if (withinBounds == 1) withinBoundsCounter++;
  7.  
  8. if (cycleCounter > 500){
  9. if (withinBoundsCounter > 400){
  10. beginLoadingSequence();
  11. }
  12. cycleCounter=0;
  13. withinBoundsCounter=0;
  14. }
  15. }
  16.  
  17. void beginLoadingSequence(){
  18. int angle = 0;
  19. for (angle=0; angle<135; angle++){
  20. delayMicroseconds(220); //approx. 3 seconds
  21. }
  22.  
  23. delayMicroseconds(30000);
  24.  
  25. for (angle=135; angle>0; angle--){
  26. delayMicroseconds(220); //approx. 3 seconds
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement