servo.ino 699 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. Servo Logic Code
  3. This script handles logic related to servo operations
  4. */
  5. //Calibrated offset to add or reduce for this particilar machine
  6. const int servoAlignmentOffset = 0;
  7. //Quickily push the switch back
  8. void pushSwitchNow() {
  9. pushSwitchDelayed(1000, 1000);
  10. }
  11. //Push switch back with delay
  12. void pushSwitchDelayed(int coverDelay, int pusherDelay) {
  13. servoCoverPusher.write(90);
  14. delay(coverDelay);
  15. servoSwitchPusher.write(130 + servoAlignmentOffset);
  16. delay(pusherDelay);
  17. servoCoverPusher.write(0);
  18. servoSwitchPusher.write(0);
  19. }
  20. //Set the pusher servo to arm installation position
  21. void setSwitchToInstallPosition(){
  22. servoSwitchPusher.write(125 + servoAlignmentOffset);
  23. }