13namespace tinyrobotics {
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
47template <
typename T =
float>
50 BrushlessMotor(uint8_t id = 0) {
this->setID(id); }
53 void setPin(
int pin) {
this->pin = pin; }
56 if (pin == -1)
return false;
62 bool setValuePercent(T percent)
override {
63 if (!servo.attached())
return false;
64 lastValuePercent = constrain(percent, -100, 100);
65 int angle = map(lastValuePercent, 0, 100, 100, 2000);
70 T getValuePercent()
const override {
71 return lastValuePercent;
79 bool isPinsSet()
const override {
return pin != -1; }
84 bool is_pin_assigned =
false;
85 T lastValuePercent = 0.0f;
Simple brushless DC motor (ESC) driver using Servo library for Arduino/ESP32.
Definition: BrushlessMotor.h:48
void setPin(int pin)
Definition: BrushlessMotor.h:53
Abstract base class for all motor driver types.
Definition: IMotor.h:21