I just used the second example to build my hobby servo program.

It swings side to side regularly starting off slow but becoming more abrupt and quick. It also becomes more erratic as the time goes on. I wanted it to feel sort of like an animal so there’s a brief pause in the program as if the animal sensed danger.

It has changes in the flow of the program as if changing its direction where its going slowly moving to a point and speeding up after finding a target.

# begin the movement sequence, starting with some slow sweeps
print("Starting linear motions.")
linear_move(servo, 0.0, 180.0, speed=45)
linear_move(servo, 180.0, 0.0, speed=22.5)
linear_move(servo, 45.0, 90, speed= 60)
linear_move(servo, 70.0, 145.0, speed= 90)
linear_move(servo, 55.0, 160, speed = 125)

# brief pause; stillness is the counterpoint
time.sleep(4.0)

# start bouncy oscillation movements
print("Starting ringing motions.")
ringing_move(servo, 90.0, duration=5)
ringing_move(servo, 45.0, duration=1.5)
ringing_move(servo, 90.0, duration=3)

time.sleep(0.1)
print("Starting linear motions.")
linear_move(servo, 20, 120.0, speed=60)
linear_move(servo, 170.0, 10.0, speed=100)
linear_move(servo, 79.0, 90, speed= 60)
linear_move(servo, 30.0, 145.0, speed= 90)

time.sleep(1.5)
print("Starting ringing motions.")
ringing_move(servo, 90.0, duration=5)
ringing_move(servo, 45.0, duration=1.5)
ringing_move(servo, 90.0, duration=3)