for motor controllers with one direction input and one speed input pin
More...
#include <JMotorDriverEsp32PWMDir.h>
|
| JMotorDriverEsp32PWMDir (byte _ch, byte _enablePin, byte _dirPin, bool _rev=false) |
| constructor, sets pins, default PWM
|
|
| JMotorDriverEsp32PWMDir (byte _ch, byte _enPin, byte _dirPin, int freq, int resolution, bool _rev=false) |
| constructor, sets pins, custom PWM 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
|
|
bool | enable () |
| enable motor
|
|
bool | disable () |
| disable motor
|
|
for motor controllers with one direction input and one speed input pin
- Note
- platform: ESP32
◆ JMotorDriverEsp32PWMDir() [1/2]
JMotorDriverEsp32PWMDir::JMotorDriverEsp32PWMDir |
( |
byte |
_ch, |
|
|
byte |
_enablePin, |
|
|
byte |
_dirPin, |
|
|
bool |
_rev = false |
|
) |
| |
|
inline |
constructor, sets pins, default PWM
- Parameters
-
_ch | ledc channel (must be unique for each driver) |
_enablePin | pin to output speed signal on |
_dirPin | pin to output direction signal on |
_rev | = false: if false(default), direction pin set HIGH for positive speed, LOW for negative speed |
◆ JMotorDriverEsp32PWMDir() [2/2]
JMotorDriverEsp32PWMDir::JMotorDriverEsp32PWMDir |
( |
byte |
_ch, |
|
|
byte |
_enPin, |
|
|
byte |
_dirPin, |
|
|
int |
freq, |
|
|
int |
resolution, |
|
|
bool |
_rev = false |
|
) |
| |
|
inline |
constructor, sets pins, custom PWM settings
- Parameters
-
_ch | ledc channel (must be unique for each driver) |
_enPin | pin to output speed signal on |
_dirPin | pin to output direction signal on |
freq | <= int(80E6 / 2^resolution), 2kHz default and recommended for motor PWM |
resolution | bits of resolution, tradeoff with frequency, default 12 |
_rev | = false: if false(default), direction pin set HIGH for positive speed, LOW for negative speed |
◆ getEnable()
bool JMotorDriverEsp32PWMDir::getEnable |
( |
| ) |
|
|
inlinevirtual |
get the enable state of the driver
- Return values
-
(bool) | true if enabled, false if disabled |
Reimplemented from JMotorDriver.
◆ getMaxRange()
float JMotorDriverEsp32PWMDir::getMaxRange |
( |
| ) |
|
|
inlinevirtual |
high end of the range
- Note
- usually 1.0
- Return values
-
Reimplemented from JMotorDriver.
◆ getMinRange()
float JMotorDriverEsp32PWMDir::getMinRange |
( |
| ) |
|
|
inlinevirtual |
low end of the range
- Note
- usually -1.0, if 0, that indicates a motor controller with no reverse function
- Return values
-
Reimplemented from JMotorDriver.
◆ set()
bool JMotorDriverEsp32PWMDir::set |
( |
float |
val | ) |
|
|
inlinevirtual |
set motor power
- Note
- val should be between getMinRange and getMaxRange, but constrained internally
- Parameters
-
- Return values
-
(bool) | false if at end of power range, true otherwise |
Reimplemented from JMotorDriver.
◆ setEnable()
bool JMotorDriverEsp32PWMDir::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.
◆ pwmDriver
◆ reverse
bool JMotorDriverEsp32PWMDir::reverse = false |
The documentation for this class was generated from the following file: