DC Motors

Post Reply
fwall
Posts: 1
http://meble-kuchenne.info.pl
Joined: Wed Nov 10, 2021 11:40 pm

DC Motors

Post by fwall »

Hi there,

I am trying to use the DC motor component in my code and I need it to move for 10 seconds. I have tried using the component macros forwards(10) and coast but is seeming to stop early, of if I use forwards(1) it won't stop! Would greatly appreciate if someone could explain how they function and how I can best code them to rotate forwards for 10 seconds and also backwards for 10 seconds. I can't find much online.

Thanks in advance

BenR
Matrix Staff
Posts: 1009
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 243 times
Been thanked: 334 times

Re: DC Motors

Post by BenR »

Hello,

The number assigned is the speed when using PWM or HBRIDGE control method. For simple on/off the number will make no difference.

Sounds like your program needs to do the following.

Forwards (1)
Delay S (10)
Stop ()

You might need a further delay at the end, if you're inside a loop with no delay at the end then we will go straight back into Forward which will appear like the Stop function never got called.

Hope this helps.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel

medelec35
Matrix Staff
Posts: 692
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 242 times
Been thanked: 244 times

Re: DC Motors

Post by medelec35 »

Hi.
If you are interested, I posted an example on this post.
Martin

chipfryer27
Valued Contributor
Posts: 102
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 84 times
Been thanked: 47 times

Re: DC Motors

Post by chipfryer27 »

Hi

Have you looked at the component example yet?

https://www.flowcode.co.uk/wiki/index.p ... :_DC_Motor_()

How are you connecting your motor? The example is for a Full-Bridge config. If you can share your flowchart and how you are connecting (even if just simulation) I'm sure the forum can assist.

Regards

Edit...
Seems Ben and Medelec beat me to posting <s> Generally speaking, always do as they suggest :)

Post Reply