silver2row

Trying Steppers for the first/last time w/ MotorBridge.py

Oct 21st, 2020
1,153
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import MotorBridge
  2. import time
  3. from flask import Flask, render_template
  4.  
  5. FirstLegOne    = 1000
  6. SecondLegTwo   = -1000
  7. LegOneGo        = 2000
  8. LegOneGo2        = -2000
  9. LegTwoGo        = 3000
  10. LegTwoGo2        = -3000
  11.  
  12. app = Flask(__name__)
  13. @app.route("/")
  14.  
  15. def StepperMotorATest(self, FirstLegOne):
  16.     print('Stepper A is on the move!')
  17.     motor.StepperMotorAInit()
  18.     motor.StepperMotorAMove(LegOne1, 1000) # 1000 steppers  1000us every step
  19.     time.sleep(4)
  20.     motor.StepperMotorAMove(LegOne2, 1000) # 1000 steppers  1000us every step
  21.     time.sleep(4)
  22.     self = self
  23.     self.FirstLegOne = LegOneGo
  24.  
  25. def StepperMotorBTest(self, SecondLegTwo):
  26.     print('Stepper B moves too!')
  27.     motor.StepperMotorBInit()
  28.     motor.StepperMotorBMove(LegTwo1, 1000) # 1000 steppers  1000us every step
  29.     time.sleep(4)
  30.     motor.StepperMotorBMove(LegTwo2, 1000) # 1000 steppers  1000us every step
  31.     time.sleep(4)
  32.     self = self
  33.     self.SecondLegTwo = LegTwoGo
  34.  
  35. if __name__=="__main__":
  36.     motor = MotorBridge.MotorBridgeCape()
  37.     a = int(input("Please enter a numerical value below 50,000 to -50,000: "))
  38.     for a in range(0, 999):
  39.         StepperMotorATest(a, FirstLegOne)
  40.         StepperMotorBTest(a, SecondLegTwo)
RAW Paste Data