Advertisement
silver2row

Trying to understand more in Python calls and Files/Classes

Oct 24th, 2020
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.56 KB | None | 0 0
  1. # Okay, I will try to explain this well enough...with what knowledge I have currently.
  2.  
  3. # First, I have a MotorBridge.py file. The file consists of line 227 of this file: https://github.com/silver2row/bbg/blob/master/MBC/MotorBridge.py which later entails some ideas on functions related to Stepper Motors.
  4.  
  5. # I know it is a class with functions in it, e.g. class MotorBridgeCape:
  6.  
  7. # I also know about the file that follows:
  8.  
  9.  
  10. # Mr. Li from Seeed Studio in '15.
  11.  
  12. import MotorBridge
  13. import time
  14.  
  15. def StepperMotorATest(): # This function is just made up?
  16.     print ('Hello From MotorBridge')
  17.     motor.StepperMotorAInit() # This is the init function from the MotorBridge.py file/MotorBridgeCape class.
  18.     motor.StepperMotorAMove(1000, 1000) # This is the CW or CCW function
  19.     time.sleep(1)
  20.     motor.StepperMotorAMove(-1000, 1000)
  21.     time.sleep(1)
  22.    
  23. #def StepperMotorBTest():
  24.     #print ('Hello From MotorBridge')
  25.     #motor.StepperMotorBInit()
  26.     #motor.StepperMotorBMove(1000, 1000)
  27.     #time.sleep(1)
  28.     #motor.StepperMotorBMove(-1000, 1000)
  29.     #time.sleep(1)
  30.  
  31.    
  32. if __name__=="__main__":
  33.     motor = MotorBridge.MotorBridgeCape() # Is this the only reason that motor.StepperMotorAInit() and motor.StepperMotorAMove() exist?
  34.                                           # I mean...b/c of me making the motor definition equal the file.class()?
  35.                                           # For instance, "WHATEVER = MyPyFile.MyClassFromMyPyFile() is why that above source works?
  36.     while True:
  37.         StepperMotorATest()
  38.         #StepperMotorBTest()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement