| 
    upm
    0.2.0
    
   Sensor/Actuator repository for libmraa (v0.6.1) 
   | 
 
C++ API for the L298 Dual H-Bridge module. More...
It was developed using the RobotBase Dual H-Bridge module.
This module can support 2 DC motors, or 1 2-phase stepper motor. It requires 3 pins per DC motor (or h-bridge), or 4 pins for the stepper (uses both h-bridges).
Example driving a DC motor
Example driving a stepper motor
Public Types | |
| enum | L298_DIRECTION_T { DIR_NONE = 0x00, DIR_CW = 0x01, DIR_CCW = 0x02 } | 
Public Member Functions | |
| L298 (int pwm, int dir1, int dir2) | |
| L298 (int stepsPerRev, int en, int i1, int i2, int i3, int i4) | |
| ~L298 () | |
| uint32_t | getMillis () | 
| void | initClock () | 
| void | setPeriodMS (int ms) | 
| void | enable (bool enable) | 
| void | setSpeed (int speed) | 
| void | setDirection (L298_DIRECTION_T dir) | 
| void | stepperSteps (unsigned int steps) | 
| L298 | ( | int | pwm, | 
| int | dir1, | ||
| int | dir2 | ||
| ) | 
L298 constructor for DC motor(s) connected.
| pwm | digital pin to use for DC motor - must be PWM capable | 
| dir1 | digital pin to use for motor direction pin 1 | 
| dir2 | digital pin to use for motor direction pin 2 | 
| L298 | ( | int | stepsPerRev, | 
| int | en, | ||
| int | i1, | ||
| int | i2, | ||
| int | i3, | ||
| int | i4 | ||
| ) | 
L298 constructor for 4-wire stepper motor
| stepsPerRev | number of steps per full revolution | 
| en | enable pin | 
| i1 | digital pin to use for stepper input 1 | 
| i2 | digital pin to use for stepper input 2 | 
| i3 | digital pin to use for stepper input 3 | 
| i4 | digital pin to use for stepper input 4 | 
| uint32_t getMillis | ( | ) | 
Return the number of milliseconds elapsed since initClock() was last called.
| void initClock | ( | ) | 
Reset the Clock
| void setPeriodMS | ( | int | ms | ) | 
set the period in milliseconds
| ms | period in milliseconds | 
| void enable | ( | bool | enable | ) | 
enable PWM output for a motor
| enable | enable PWM output if true, disable if false | 
| void setSpeed | ( | int | speed | ) | 
set the speed of a DC or stepp motor. For a DC motor, Values can range from 0 (off) to 100 (full speed). For a stepper motor, specify the desired RPM.
| speed | speed to set the motor to | 
| void setDirection | ( | L298_DIRECTION_T | dir | ) | 
set the direction of the motor, clockwise or counter clockwise
| dir | direction to set the motor to | 
| void stepperSteps | ( | unsigned int | steps | ) | 
step the stepper motor a specified number of steps
| steps | number of steps to move the stepper motor | 
 1.8.9.1