Problem with PWM disable

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

Post Reply
Zyxcel314
Posts: 3
Joined: Thu May 18, 2017 8:57 am

Problem with PWM disable

Post by Zyxcel314 »

Have to create for a exam a program to allow to a robot to follow a lines. For this program, I used 4 PWM which works by pair for the four wheels. Only, while I try to simulate the program, I have an "impossible" configuration where I have 3 PWM activated. Also, I can't disactivated PWM blocks when I activated two.
Thanks for your help, here is the program and the: ATMEGA328P.
Attachments
Prog F 3 capteur 2 TEST 11_05_2017.fcfx
(19.11 KiB) Downloaded 153 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: Problem with PWM disable

Post by Benj »

Hello,

Your program doesn't contain any delays and so it looks like the program will loop around at high speed enabling and disabling the PWM. Probably so fast that you think the disable is not working.

Please see this page on finite state machines, they might help you to craft a working program without resorting to using delays.
https://www.flowcode.co.uk/wikiv7/index. ... ateMachine

Zyxcel314
Posts: 3
Joined: Thu May 18, 2017 8:57 am

Re: Problem with PWM disable

Post by Zyxcel314 »

Thank you for your response but I try to put delays at different places ( 5ms ) but the problem stay the same. For example, when the program starts PWM 1 and 3 are activated but when I switch on the left captor ( the left switch on the
2D pannel ) the Pwm 2 and 3 are activated but the third PWM doesn't want to be disabled altough everything in the end of the program is made to disable it.

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: Problem with PWM disable

Post by Benj »

Hello,

With 5ms delays you will still be struggling to actually see the channel being disabled, I know I can't see things that last only 5ms.

Maybe try slowing things down while you develop the code and replace 5ms with say 5s. The disable is certainly known to work so this hopefully shouldn't be a problem.

Are you using just the simulation or are you also using hardware to test your program?

Zyxcel314
Posts: 3
Joined: Thu May 18, 2017 8:57 am

Re: Problem with PWM disable

Post by Zyxcel314 »

Yes, I want put the program into the arduino card of a kind of little car

Post Reply