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.
Problem with PWM disable
Moderator: Benj
Problem with PWM disable
- Attachments
-
- Prog F 3 capteur 2 TEST 11_05_2017.fcfx
- (19.11 KiB) Downloaded 153 times
- 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
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
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
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: Problem with PWM disable
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.
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.
- 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
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?
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?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: Problem with PWM disable
Yes, I want put the program into the arduino card of a kind of little car