Line: 1 to 1 | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
MotorsIntroduction | |||||||||||||||
Line: 44 to 44 | |||||||||||||||
| |||||||||||||||
Added: | |||||||||||||||
> > | I wrote and integrated into the MicroPython binary a simple servo driver which makes it extremely simple to control the servo motor: | ||||||||||||||
Changed: | |||||||||||||||
< < |
I wrote and integrated into the MicroPython binary a simple servo driver which makes it extremely simply to control the servo motor: from servo import Servo servo = Servo() servo.angle(90) | ||||||||||||||
> > | from servo import Servo servo = Servo() servo.angle(90) | ||||||||||||||
will move the servo to 90 degrees. | |||||||||||||||
Added: | |||||||||||||||
> > | Stepping MotorIn order to learn about how stepping motors work please refer to the 2017 course on embedded systems lecture 9: UCC_Course/Lecture9:SteppingMotors. We will use a 27BJY-48 stepper motor with its associated ULN-2803 driver module. http://robocraft.ru/files/datasheet/28BYJ-48.pdf is the data sheet of the motor and https://www.sparkfun.com/datasheets/IC/uln2803a.pdf is the datasheet of the ULN-2803 Darlington Transistor array. The stepping Motor class included in the MicroPython binary uses the following default connections
from stepper import steppingMotor stepper = steppingMotor() # the parameters p1,p2,p3,p4 are optional and allow to connect the stepping motor to different GPIO linesThe steppingMotor class uses different modes for stepping:
stepper.stepMode(stepper.DOUBLE_PHASE_FORWARD)You can change the movement speed with the method waitAfterSteps() which defines how long to wait after each step in ms. Valid values are 2..1000. Again the method returns the value currently in use if called without a parameter. The method clrAll() set all coils (IN1..IN4) to zero. Finally the method move(noOfSteps) moves the stepping motor noOfSteps in the mode and with the speed currently selected. | ||||||||||||||
-- Uli Raich - 2020-06-25 |