-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
bug 🐛Something isn't workingSomething isn't working
Milestone
Description
Describe the bug
The Servo library calls the write()
function within the attach()
function
write(value); |
this->min
and this->max
values Arduino_Core_STM32/libraries/Servo/src/stm32/Servo.cpp
Lines 126 to 127 in 641f3d8
this->min = (MIN_PULSE_WIDTH - min) / 4; //resolution of min/max is 4 uS | |
this->max = (MAX_PULSE_WIDTH - max) / 4; |
write()
function to work correctly when the servo position is set in degrees. The function write()
uses the this->min
and this->max
values to map the passed value in degrees between min and max https://github.com/stm32duino/Arduino_Core_STM32/blob/641f3d8883e9a7220f65dded355dc32e218a990d/libraries/Servo/src/stm32/Servo.cpp#L156/
To Reproduce
int min = 40;
int max = 70;
int value = 40;
// on first call to attach, the write is called with a different value in this->min and this->max than on following calls
Servo.attach(pin, min, max, value)
- STM32 core version: 2.7.1
The write()
function should either not be called in the attach()
function at all, or it must be called after this->min
and this->max
are configured.
Metadata
Metadata
Assignees
Labels
bug 🐛Something isn't workingSomething isn't working
Type
Projects
Status
Done