JMotor
Loading...
Searching...
No Matches
JMotorDriverServoDual.h
Go to the documentation of this file.
1#ifndef J_MOTOR_DRIVER_SERVO_DUAL_H
2#define J_MOTOR_DRIVER_SERVO_DUAL_H
3#include "JMotorDriverServo.h"
4#include <Arduino.h>
10public:
14 : m1(_m1)
15 , m2(_m2)
16 {
17 }
18 bool set(float val)
19 {
20 bool m1state = m1.set(val);
21 bool m2state = m2.set(val);
22 return m1state && m2state;
23 }
24 bool setEnable(bool _enable)
25 {
26 bool m1state = m1.setEnable(_enable);
27 bool m2state = m2.setEnable(_enable);
28 return m1state || m2state;
29 }
30 bool getEnable()
31 {
32 bool m1state = m1.getEnable();
33 bool m2state = m2.getEnable();
34 return m1state || m2state;
35 }
37 {
38 return min(m1.getMaxRange(), m2.getMaxRange());
39 }
41 {
42 return max(m1.getMinRange(), m2.getMinRange());
43 }
44
45 void setMinServoValue(int value)
46 {
47 m1.setMinServoValue(value);
48 m2.setMinServoValue(value);
49 }
50 void setMaxServoValue(int value)
51 {
52 m1.setMaxServoValue(value);
53 m2.setMaxServoValue(value);
54 }
56 {
57 return min(m1.getMinServoValue(), m2.getMinServoValue());
58 }
60 {
61 return max(m1.getMaxServoValue(), m2.getMaxServoValue());
62 }
64 {
66 }
67 void setServoValues(int min, int max)
68 {
71 }
72};
73#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 JMotorDriverServos as if they are one driver
Definition JMotorDriverServoDual.h:9
int getMaxServoValue()
Definition JMotorDriverServoDual.h:59
void setMinServoValue(int value)
Definition JMotorDriverServoDual.h:45
float getMinRange()
low end of the range
Definition JMotorDriverServoDual.h:40
void setServoValues(int min, int max)
Definition JMotorDriverServoDual.h:67
JMotorDriverServo & m1
Definition JMotorDriverServoDual.h:11
bool getEnable()
get the enable state of the driver
Definition JMotorDriverServoDual.h:30
int getServoValueRange()
Definition JMotorDriverServoDual.h:63
bool setEnable(bool _enable)
use to enable or disable a motor, and sets up pin states
Definition JMotorDriverServoDual.h:24
void setMaxServoValue(int value)
Definition JMotorDriverServoDual.h:50
float getMaxRange()
high end of the range
Definition JMotorDriverServoDual.h:36
JMotorDriverServo & m2
Definition JMotorDriverServoDual.h:12
bool set(float val)
set motor power
Definition JMotorDriverServoDual.h:18
int getMinServoValue()
Definition JMotorDriverServoDual.h:55
JMotorDriverServoDual(JMotorDriverServo &_m1, JMotorDriverServo &_m2)
Definition JMotorDriverServoDual.h:13
class that can be used to specify a driver that controls specifically a servo
Definition JMotorDriverServo.h:8
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