siMulation PWM Motor

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
Camille
Posts: 17
Joined: Mon Mar 20, 2017 9:39 pm
Has thanked: 5 times
Been thanked: 3 times

siMulation PWM Motor

Post by Camille »

hello
I'M trying to Made dynamic change speed Motor according to pwM duty in simulation...
But property.set Value speed on Motor seems not running...
Regards
Attachments
pwMMotor.fcfx
(4.71 KiB) Downloaded 376 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: siMulation PWM Motor

Post by Benj »

Hello Camille,

You were nearly there.

I think the component detects a pin change and then assigns the motor speed. So by adding a few motor stops and starts to the loop this forces the pin change to fire which then correctly switches the speed.
pwMMotor.fcfx
(6.79 KiB) Downloaded 403 times

Camille
Posts: 17
Joined: Mon Mar 20, 2017 9:39 pm
Has thanked: 5 times
Been thanked: 3 times

Re: siMulation PWM Motor

Post by Camille »

yes so fine!
thanks.

Camille
Posts: 17
Joined: Mon Mar 20, 2017 9:39 pm
Has thanked: 5 times
Been thanked: 3 times

Re: siMulation PWM Motor

Post by Camille »

I take a look to CAL PWM is there a complete example with Ev_property change macro for make a complete pwm motor component with speed according on duty?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: siMulation PWM Motor

Post by Benj »

Hi Camille,

The formula Flowcode and Formula AllCode robots work in this way PWM which controls a motor and travelled distance in simulation.

I wrote an Instructables tutorial a while back on creating a 2 wheel robot which should hopefully contain the bits you need in Steps 4-6.

https://www.instructables.com/id/Two-Wh ... -Simulate/

Let me know how you're getting on.

Post Reply