Tom
February 28, 2020, 9:40am
1
When I use the example:
#include <hFramework.h>
#include <cmath>
void hMain()
{
hServoModule.enablePower(); // enable servos
hServoModule.setVoltage5V(); // set power line voltage for all servos to about 5 [V].
hServoModule.servo1.calibrate(-90, 700, 90, 1500); // calibrate servo with params minAngle, minWidth, maxAngle, maxWidth
while (true)
{
int time = sys.getRefTime();
float pos = sinf(time / 3000.0f * 2 * M_PI);
hServoModule.servo1.rotAbs(pos * 90.0f); // wave the servo there and back using `sin` function
}
}
I got 4 warnings:
The similar topic was found in:
https://community-mirror.husarion.com/t/solved-hservomodule-deprecated/869
but I am not convinced with the explanation.
Could someone refer to it? It is not serious problem as it is only “warning” but
anyway it is good to know the reason.
Tom
Hi Tom,
It’s only warring about deprecated declaration of function. We add possibility to use hServo
instead hServoModule
for code simplification, but we didn’t delete old syntax, in order not to cause compilation errors in old programs of our users.
Best regards,
Hubert
Tom
March 3, 2020, 3:02pm
3
Hi Hubert,
Thank you for your explanation.
Now it is clear.
Best wishes
Tom