Encoder troubles

For general Flowcode discussion that does not belong in the other sections.
Post Reply
Zhmil1789
Posts: 8
http://meble-kuchenne.info.pl
Joined: Sun Mar 01, 2026 6:50 pm
Has thanked: 7 times

Flowcode v10 Encoder troubles

Post by Zhmil1789 »

Hello,

I tried to control a servo with an encoder, and I have some troubles. I cannot find where I made a mistake. I will be thankful if someone checks my project.

Best regards,
Zhmil1789
Attachments
encoder.fcfx
(13.75 KiB) Downloaded 24 times
Screenshot 2026-05-14 072740.png
Screenshot 2026-05-14 072740.png (202.23 KiB) Viewed 90 times

BenR
Matrix Staff
Posts: 2204
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 603 times
Been thanked: 800 times

Re: Encoder troubles

Post by BenR »

Hello,

You need to either poll the encoder at a high rate or you need to enable edge driven interrupts to catch when the encoder moves.

Here's an example of each method, the edge driven approach is much more suitable if you can use that as the interrupt only fires when the encoder moves.

encoder_timer.fcfx
(16.56 KiB) Downloaded 20 times
encoder_edge.fcfx
(17.37 KiB) Downloaded 22 times

Zhmil1789
Posts: 8
Joined: Sun Mar 01, 2026 6:50 pm
Has thanked: 7 times

Re: Encoder troubles

Post by Zhmil1789 »

Hello Ben,

Thank you for the examples. Unfortunately neither encoder_timer.fcfx nor encoder_edge.fcfx work on my Flowcode 10. The servo still does not move in simulation.

Is there anything different I need to do in Flowcode 10 to make the encoder work with a servo?

Best regards,
Zhmil1789

BenR
Matrix Staff
Posts: 2204
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 603 times
Been thanked: 800 times

Re: Encoder troubles

Post by BenR »

Your maths to do the servo motion from the encoder count looks a little off, what are you trying to acheive there?

Maybe for now just try connecting the servo angle to the encoder count and see how you get on there.

Post Reply