JMotor
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
JMotorDriverEsp32L293 Class Reference

L293 motor driver chip: https://www.ti.com/lit/ds/symlink/l293.pdf also works with L298 drivers or anything with two direction pins and an enable pin! More...

#include <JMotorDriverEsp32L293.h>

Inheritance diagram for JMotorDriverEsp32L293:
Inheritance graph
[legend]
Collaboration diagram for JMotorDriverEsp32L293:
Collaboration graph
[legend]

Public Member Functions

 JMotorDriverEsp32L293 (byte _ch, byte _enablePin, byte _i1, byte _i2, bool _breakOn=true, bool _breakWhenDisabled=false, bool _reverse=false, int _freq=2000, int _resolution=12)
 constructor, sets pins and other settings
 
bool set (float val)
 set motor power
 
bool setEnable (bool _enable)
 use to enable or disable a motor, and sets up pin states
 
bool getEnable ()
 get the enable state of the driver
 
float getMaxRange ()
 high end of the range
 
float getMinRange ()
 low end of the range
 
- Public Member Functions inherited from JMotorDriver
bool enable ()
 enable motor
 
bool disable ()
 disable motor
 

Public Attributes

JMotorDriverEsp32PWM pwmDriver
 
bool breakOn
 add extra resistance to motor when set to 0 power (by shorting motor terminals)
 
bool reverse
 reverse direction of driver
 

Detailed Description

L293 motor driver chip: https://www.ti.com/lit/ds/symlink/l293.pdf also works with L298 drivers or anything with two direction pins and an enable pin!

Note
platform: ESP32

Constructor & Destructor Documentation

◆ JMotorDriverEsp32L293()

JMotorDriverEsp32L293::JMotorDriverEsp32L293 ( byte  _ch,
byte  _enablePin,
byte  _i1,
byte  _i2,
bool  _breakOn = true,
bool  _breakWhenDisabled = false,
bool  _reverse = false,
int  _freq = 2000,
int  _resolution = 12 
)
inline

constructor, sets pins and other settings

Parameters
_chledc channel (must be unique for each driver)
_enablePinenable(speed) pin on driver
_i1input pin 1 (direction)
_i2input pin 2 (direction)
_breakOn= true: if true (default), add extra resistance to motor when set to 0 power (by shorting motor terminals)
_breakWhenDisabled= false: if false (default) turn off break when disabled, if true, keep electrically breaking
_reverse(bool) default=false, reverse direction of driver
_freq<= int(80E6 / 2^resolution), 2kHz default and recommended for motor PWM
_resolutionbits of resolution, tradeoff with frequency, default 12

Member Function Documentation

◆ getEnable()

bool JMotorDriverEsp32L293::getEnable ( )
inlinevirtual

get the enable state of the driver

Return values
(bool)true if enabled, false if disabled

Reimplemented from JMotorDriver.

◆ getMaxRange()

float JMotorDriverEsp32L293::getMaxRange ( )
inlinevirtual

high end of the range

Note
usually 1.0
Return values
(float)maxRange

Reimplemented from JMotorDriver.

◆ getMinRange()

float JMotorDriverEsp32L293::getMinRange ( )
inlinevirtual

low end of the range

Note
usually -1.0, if 0, that indicates a motor controller with no reverse function
Return values
(float)minRange

Reimplemented from JMotorDriver.

◆ set()

bool JMotorDriverEsp32L293::set ( float  val)
inlinevirtual

set motor power

Note
val should be between getMinRange and getMaxRange, but constrained internally
Parameters
val(float) val
Return values
(bool)false if at end of power range, true otherwise

Reimplemented from JMotorDriver.

◆ setEnable()

bool JMotorDriverEsp32L293::setEnable ( bool  _enable)
inlinevirtual

use to enable or disable a motor, and sets up pin states

Note
setEnable(true) must be called before a motor driver will activate
Parameters
_enable(bool) true=enable, false=disable
Return values
(bool)true if state changed, false if state already set

Reimplemented from JMotorDriver.

Member Data Documentation

◆ breakOn

bool JMotorDriverEsp32L293::breakOn

add extra resistance to motor when set to 0 power (by shorting motor terminals)

◆ pwmDriver

JMotorDriverEsp32PWM JMotorDriverEsp32L293::pwmDriver

◆ reverse

bool JMotorDriverEsp32L293::reverse

reverse direction of driver


The documentation for this class was generated from the following file: