running a DC motor using the arduino motor shield

For general Flowcode discussion that does not belong in the other sections.
medelec35
Matrix Staff
Posts: 1432
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 506 times
Been thanked: 469 times

Re: running a DC motor using the arduino motor shield

Post by medelec35 »

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.
Martin

chipfryer27
Valued Contributor
Posts: 1110
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 278 times
Been thanked: 397 times

Re: running a DC motor using the arduino motor shield

Post by chipfryer27 »

Hi Martin

Thanks for the clarification. I'll check the compiler messages later too.

Regards

peterhalloway
Posts: 11
Joined: Sat Nov 20, 2021 11:28 am

Re: running a DC motor using the arduino motor shield

Post by peterhalloway »

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

chipfryer27
Valued Contributor
Posts: 1110
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 278 times
Been thanked: 397 times

Re: running a DC motor using the arduino motor shield

Post by chipfryer27 »

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
Attachments
DC motor_Test_1.fcfx
(9.97 KiB) Downloaded 62 times

peterhalloway
Posts: 11
Joined: Sat Nov 20, 2021 11:28 am

Re: running a DC motor using the arduino motor shield

Post by peterhalloway »

correction the motor is now running thank you can you please explain what I did wrong

Post Reply