JMotor
Loading...
Searching...
No Matches
JMotorDriverServoAdvancedDual.h
Go to the documentation of this file.
1#ifndef J_MOTOR_DRIVER_SERVO_ADVANCED_DUAL_H
2#define J_MOTOR_DRIVER_SERVO_ADVANCED_DUAL_H
4#include <Arduino.h>
10public:
18 void adjustFrequency(float freq)
19 {
20 m1.adjustFrequency(freq);
21 m2.adjustFrequency(freq);
22 }
23 bool set(float val)
24 {
25 bool m1state = m1.set(val);
26 bool m2state = m2.set(val);
27 return m1state && m2state;
28 }
29 bool setEnable(bool _enable)
30 {
31 bool m1state = m1.setEnable(_enable);
32 bool m2state = m2.setEnable(_enable);
33 return m1state || m2state;
34 }
35 bool getEnable()
36 {
37 bool m1state = m1.getEnable();
38 bool m2state = m2.getEnable();
39 return m1state || m2state;
40 }
42 {
43 return min(m1.getMaxRange(), m2.getMaxRange());
44 }
46 {
47 return max(m1.getMinRange(), m2.getMinRange());
48 }
49
50 void setMinServoValue(int value)
51 {
52 m1.setMinServoValue(value);
53 m2.setMinServoValue(value);
54 }
55 void setMaxServoValue(int value)
56 {
57 m1.setMaxServoValue(value);
58 m2.setMaxServoValue(value);
59 }
61 {
62 return min(m1.getMinServoValue(), m2.getMinServoValue());
63 }
65 {
66 return max(m1.getMaxServoValue(), m2.getMaxServoValue());
67 }
69 {
71 }
72 void setServoValues(int min, int max)
73 {
76 }
77};
78#endif
virtual bool set(float val)
set motor power
virtual bool setEnable(bool _enable)
use to enable or disable a motor, and sets up pin states
virtual float getMaxRange()
high end of the range
virtual float getMinRange()
low end of the range
virtual bool getEnable()
get the enable state of the driver
control two JMotorDriverServoAdvanced as if they are one driver
Definition JMotorDriverServoAdvancedDual.h:9
int getMinServoValue()
Definition JMotorDriverServoAdvancedDual.h:60
int getMaxServoValue()
Definition JMotorDriverServoAdvancedDual.h:64
void adjustFrequency(float freq)
adjust frequency as a fraction of standard 50hz frequency lower frequencies (try ....
Definition JMotorDriverServoAdvancedDual.h:18
bool set(float val)
set motor power
Definition JMotorDriverServoAdvancedDual.h:23
void setServoValues(int min, int max)
Definition JMotorDriverServoAdvancedDual.h:72
void setMaxServoValue(int value)
Definition JMotorDriverServoAdvancedDual.h:55
void setMinServoValue(int value)
Definition JMotorDriverServoAdvancedDual.h:50
float getMaxRange()
high end of the range
Definition JMotorDriverServoAdvancedDual.h:41
bool setEnable(bool _enable)
use to enable or disable a motor, and sets up pin states
Definition JMotorDriverServoAdvancedDual.h:29
float getMinRange()
low end of the range
Definition JMotorDriverServoAdvancedDual.h:45
int getServoValueRange()
Definition JMotorDriverServoAdvancedDual.h:68
bool getEnable()
get the enable state of the driver
Definition JMotorDriverServoAdvancedDual.h:35
JMotorDriverServoAdvanced & m2
Definition JMotorDriverServoAdvancedDual.h:12
JMotorDriverServoAdvanced & m1
Definition JMotorDriverServoAdvancedDual.h:11
JMotorDriverServoAdvancedDual(JMotorDriverServoAdvanced &_m1, JMotorDriverServoAdvanced &_m2)
Definition JMotorDriverServoAdvancedDual.h:13
defines interface for servo driver with variable frequency, subclass of JMotorDriverServo and JMotorD...
Definition JMotorDriverServoAdvanced.h:8
virtual void adjustFrequency(float freq)=0
adjust frequency as a fraction of standard 50hz frequency lower frequencies (try ....
void setMinServoValue(int value)
microseconds for shortest servo pulse
Definition JMotorDriverServo.h:23
void setMaxServoValue(int value)
microseconds for longest servo pulse
Definition JMotorDriverServo.h:31
int getMaxServoValue()
returns setting for microseconds for longest servo pulse
Definition JMotorDriverServo.h:47
int getMinServoValue()
returns setting for microseconds for shortest servo pulse
Definition JMotorDriverServo.h:39