pyupm_l298 module¶
-
class
pyupm_l298.
L298
(*args)[source]¶ Bases:
object
API for the L298 Dual H-Bridge Motor Driver.
ID: l298
Name: Dual H-bridge Motor Driver
Category: motor
Manufacturer: seeed sparkfun
Link:https://www.sparkfun.com/products/9670
Connection: gpio pwm It was developed using the RobotBase Dual H-Bridge module.
This module can support 2 DC motors, or one 2-phase stepper motor. It requires 3 pins per DC motor (or H-bridge), or 4 pins for the stepper motor (uses both H-bridges).
L298 Dual H-Bridge Motor Driver image provided by SparkFun* underCC BY-NC-SA-3.0.
Example driving a DC motorExample driving a stepper motor
C++ includes: l298.hpp
-
DIR_CCW
= 2¶
-
DIR_CW
= 1¶
-
DIR_NONE
= 0¶
-
enable
(enable)[source]¶ void enable(bool enable)
Enables the PWM output for a motor
enable: Enables the PWM output if true, disables if false
-
getMillis
()[source]¶ uint32_t getMillis()
Returns the number of milliseconds elapsed since initClock() was last called.
Elapsed milliseconds
-
setDirection
(dir)[source]¶ void setDirection(L298_DIRECTION_T dir)
Sets the direction of the motor, clockwise or counterclockwise
dir: Direction to set the motor to
-
setPeriodMS
(ms)[source]¶ void setPeriodMS(int ms)
Sets the period in milliseconds
ms: Period in milliseconds
-