A python script for Raspberry Pi that moves servo's angle with smoothly using cosine. That project does not serve a complete module, it just provides an algorithm to inspire.
Controlling the servo's acceleration. Starting slowly, then fast, then stop slowly.
Just download the "servoSmoothMove.py" file and add it to your project.
These are key variables and you can edit according to your needings;
#servo's connected pin.
servoPIN = 15
#movement data.
start_pos = 40
end_pos = 160
The script uses the cosine function to provide smooth movement. When printing the movement value to the console we get that result and servo's movement will be like that.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
You can open an issue, send an email.
Happy coding :)