wraps standard servo library. For servos and motor controllers that use servo signals (ESCs)
More...
#include <JMotorDriverAvrServo.h>
|
| JMotorDriverAvrServo (byte _servoPin, int _minServoValue=544, int _maxServoValue=2400, bool _constrainRange=true) |
| constructor, sets pins
|
|
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
|
|
void | setMinServoValue (int value) |
| microseconds for shortest servo pulse
|
|
void | setMaxServoValue (int value) |
| microseconds for longest servo pulse
|
|
int | getMinServoValue () |
| returns setting for microseconds for shortest servo pulse
|
|
int | getMaxServoValue () |
| returns setting for microseconds for longest servo pulse
|
|
int | getServoValueRange () |
| returns difference (in microseconds) between longest and shortest servo pulse settings
|
|
void | setServoValues (int min, int max) |
| set the settings for short and long servo pulses at the same time
|
|
int | getSetMicroseconds () |
| returns how many microseconds the servo signal pulse was most recently set to
|
|
bool | getConstrainRange () |
| returns whether the range of set() will be constrained to within -1 and 1
|
|
void | setConstrainRange (bool _constrainRange) |
| set whether the range of set() will be constrained to within -1 and 1
|
|
bool | enable () |
| enable motor
|
|
bool | disable () |
| disable motor
|
|
wraps standard servo library. For servos and motor controllers that use servo signals (ESCs)
- Note
- compatible with all boards that support analogWrite()
◆ JMotorDriverAvrServo()
JMotorDriverAvrServo::JMotorDriverAvrServo |
( |
byte |
_servoPin, |
|
|
int |
_minServoValue = 544 , |
|
|
int |
_maxServoValue = 2400 , |
|
|
bool |
_constrainRange = true |
|
) |
| |
|
inline |
constructor, sets pins
- Parameters
-
_servoPin | pin to attach servo to |
_minServoValue | (int) minimum servo pulse, default: 544 microseconds |
_maxServoValue | (int) maximum servo pulse, default: 2400 microseconds |
_constrainRange | (bool) constrain range of set() to within -1 and 1, default: true |
◆ getEnable()
bool JMotorDriverAvrServo::getEnable |
( |
| ) |
|
|
inlinevirtual |
get the enable state of the driver
- Return values
-
(bool) | true if enabled, false if disabled |
Reimplemented from JMotorDriver.
◆ getMaxRange()
float JMotorDriverAvrServo::getMaxRange |
( |
| ) |
|
|
inlinevirtual |
high end of the range
- Note
- usually 1.0
- Return values
-
Reimplemented from JMotorDriver.
◆ getMinRange()
float JMotorDriverAvrServo::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 JMotorDriverAvrServo::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 JMotorDriverAvrServo::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.
The documentation for this class was generated from the following file: