The period register is misleading on the AVR range as it's always fixed at 256, there no period control register.
Therefore, as the period on PWM and the motor shield only shows 0 to 255 and not 256, the frequency displayed will not be correct.
It's not anything you are doing wrong.
You should see a warning about the period control register when compiling.
running a DC motor using the arduino motor shield
-
- Matrix Staff
- Posts: 1921
- http://meble-kuchenne.info.pl
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 623 times
- Been thanked: 645 times
-
- Valued Contributor
- Posts: 1528
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 353 times
- Been thanked: 549 times
Re: running a DC motor using the arduino motor shield
Hi Martin
Thanks for the clarification. I'll check the compiler messages later too.
Regards
Thanks for the clarification. I'll check the compiler messages later too.
Regards
-
- Posts: 33
- Joined: Sat Nov 20, 2021 11:28 am
- Has thanked: 1 time
Re: running a DC motor using the arduino motor shield
Hi Martin
I have updated flowcode reprogrammed the arduino but still the motor does not turn. I also did not get a compiler warning. I am sure there is something simple I am doing wrong?
Pete
I have updated flowcode reprogrammed the arduino but still the motor does not turn. I also did not get a compiler warning. I am sure there is something simple I am doing wrong?
Pete
-
- Valued Contributor
- Posts: 1528
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 353 times
- Been thanked: 549 times
Re: running a DC motor using the arduino motor shield
Hi
Try the attached.
Do you have a logic analyser or scope? If so look at the output pin on the Uno, it should show a 50/50 square wave. If not perhaps try an led with a resistor in series. It won't flash but if you change duty to 255 it should then be brighter than 128. This will at least prove your Uno is functioning.
Regards
Try the attached.
Do you have a logic analyser or scope? If so look at the output pin on the Uno, it should show a 50/50 square wave. If not perhaps try an led with a resistor in series. It won't flash but if you change duty to 255 it should then be brighter than 128. This will at least prove your Uno is functioning.
Regards
- Attachments
-
- DC motor_Test_1.fcfx
- (9.97 KiB) Downloaded 418 times
-
- Posts: 33
- Joined: Sat Nov 20, 2021 11:28 am
- Has thanked: 1 time
Re: running a DC motor using the arduino motor shield
correction the motor is now running thank you can you please explain what I did wrong