SERVO AND FADE . fast start . slow return

Hello. friends tell me how to make the servo respond immediately to changes in the value from the potentiometer from 0 to 1 upward, but if the potentiometer in position 0 the servo drive returns smoothly at a given speed

Here is my 1st attempt (one pulse-on-true & one pulse-on-false):


But I quickly realized that changing POT while rotate-slow was still moving servo could have rotate & rotate-slow both trying to move servo at the same time. Since rotate-slow uses MUTEX to lock the servo, we could change rotate to rotate-slow with a fast rate & share MUTEX with both, but it is probably easier just to use one rotate-slow node & change the rate:

image

If current value is greater than POT, use a slow RATE; otherwise, use a fast rate. You can adjust both rates to suite your program in the if-else node.

Thanks for the quick response. I will definitely try

tried the sketch. it loads without problems but I can’t understand why it doesn’t work

Did you change port D0 for another value? D0 and D1 are used for debug therefore if active debug or has connected to the pc will not work

position-value is not updating UPD

Looks like a couple issues. As cesars noted, position-value-UPD should be set to loop (or pot-DONE could be linked to it).

rotate-slow-DO will also need to get a pulse. This could also come from pot-DONE, but it would probably be better to have pot-VAL link to a pulse-on-change, then to rotate-slow-DO.

everything worked. position value upd in the loop. and pulse done from potentiometer to D0

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.