Page 2 of 2

Re: Servo MoveToAngle

Posted: Fri Sep 25, 2026 7:38 am
by chipfryer27
Hi Martin

Thanks for this. I'll try and test it out later today and let you know how I get on.

Regards

Re: Servo MoveToAngle

Posted: Fri Sep 25, 2026 12:32 pm
by chipfryer27
Hi Martin

Using a PIC18877 @ 32MHz and a MG90S servo which should give 180 degrees of rotation for widths between 1mS - 2mS, on my virtual scope I get for MoveToAngle (byte 0 - 180) pulse widths of

0 = 1mS
45 = 1.25mS
90 = 1.49mS
135 = 1.73mS
180 = 1.99mS

My proper scopes may show something more accurate but any difference would be trivial and the above is more than accurate enough for me.

However that only moves by 50% of expected. 90 moves by 45 degrees and 180 moves by 90 degrees. This is more to do with the cheapo servo I am using than anything Flowcode related.

Using MoveToPosition with byte values of 0 - 255 I got widths of

0 = 1mS
64 = 1.25mS
128 = 1.50mS
196 = 1.76mS
255 = 1.99mS

Again this moved 50% of expected and again is due to the servo.

Thanks for fixing.

Regards

Re: Servo MoveToAngle

Posted: Fri Sep 25, 2026 12:33 pm
by BenR
Thanks Martin, I've been through and merged in your changes as well as added a new SetCalibrationAngle function to allow the angles to be calibrated to a specific motor. Once calibrated it means if you ask for a movement of 10 degrees then you should get 10 degrees.

Iain - If you're range of motion is a bit low you can increase the max us pulse width timing to around 2500. You can also maybe bring the min down a bit to say 750 or 500.

Re: Servo MoveToAngle

Posted: Fri Sep 25, 2026 12:50 pm
by medelec35
Your welcome.
BenR wrote: ↑
Fri Sep 25, 2026 12:33 pm
added a new SetCalibrationAngle function to allow the angles to be calibrated to a specific motor. Once calibrated it means if you ask for a movement of 10 degrees then you should get 10 degrees.
Wow sounds like a great component has got even better!
Thanks Ben

Re: Servo MoveToAngle

Posted: Fri Sep 25, 2026 1:04 pm
by chipfryer27
Hi
Thanks Martin, I've been through and merged in your changes as well as added a new SetCalibrationAngle function to allow the angles to be calibrated to a specific motor. Once calibrated it means if you ask for a movement of 10 degrees then you should get 10 degrees.

Iain - If you're range of motion is a bit low you can increase the max us pulse width timing to around 2500. You can also maybe bring the min down a bit to say 750 or 500.
FC informed of a new update (for the component) just after I posted my findings above, so I downloaded it and got no output...

I then saw Ben's post above and thought that I might now have extra steps to make it move, such as adding in the Set Calibration value. This I did but I still don't get any output.

Am I missing something? If I roll back the component it provides an output.

Regards

Re: Servo MoveToAngle

Posted: Fri Sep 25, 2026 1:23 pm
by medelec35
Hi Iain.
Do you get an output if you use the latest fcpx I added to my post that shows updated values?

Re: Servo MoveToAngle

Posted: Fri Sep 25, 2026 1:30 pm
by chipfryer27
Hi Martin

My post of 11:32am above used your component downloaded about fifteen minutes earlier and gave outputs similar to yourself.

Regards

Re: Servo MoveToAngle

Posted: Fri Sep 25, 2026 3:24 pm
by chipfryer27
Hi

I'm not a 100% certain I checked default Pin output after updating to latest component. I downloaded and did a reload as I had my chart open. I think I did but not 100%.

If the component went to a default then that would explain why I didn't get any output as the chances of the default being the port/pin I'm using is low :), but as it did come up showing two channels it clearly has picked up some of my settings.

I'll check when I get a chance.

Regards

EDIT.....

Opened up a previous chart on another laptop that uses the servo controller and was informed of the update. The update didn't change the pin I had allocated so it looks like there may be a problem with the update.

Re: Servo MoveToAngle

Posted: Fri Sep 25, 2026 3:44 pm
by medelec35
Hi Iain.
Sorry I did not see your post, I have read it now.
I agree I could not get the servo to work either.
I have modified Bens version so it work and has his additional functions.
Can you give that a try instead?

Re: Servo MoveToAngle

Posted: Fri Sep 25, 2026 3:50 pm
by chipfryer27
Hi Martin

I can try it tomorrow but if you have it working I'm sure it will be good.

Thanks