DC motor control with potentiometer

Ian230689:
I soldered the pots in series

No, this is actually in parallel, which is what I thought from your description. Pictures are indeed worth 1000s of words :wink:

Ian230689:
when I wrote the second part of the code I assumed the other terminal for the second motor to be 13.

arduin_ologist:
You can't assume anything about which pins a shield uses: the documentation should surely say which pin is which?

Have you verified that assumption?

And those 9V transistor radio batteries are useless...

Your picture shows the pots connected to analog pins 1 and 4, but you are reading from 2 and 5. Why?

PaulS:
Your picture shows the pots connected to analog pins 1 and 4, but you are reading from 2 and 5. Why?

Looks like 2 and 5 to me... (not sure what happened to 6 and 7 though, looks like a glitch in the fritz.)

arduin_ologist:
Looks like 2 and 5 to me... (not sure what happened to 6 and 7 though, looks like a glitch in the fritz.)

Damn. Counted from the wrong end.

arduin_ologist:
Have you verified that assumption?

And those 9V transistor radio batteries are useless...

I am using a mains supply with a 9V plug! I did not have the option to use that in the app so just used a battery to show voltage going in.

Ian230689:
I am using a mains supply with a 9V plug!

Ok, but did you verify anywhere in the docs that pin 13 is the correct pin number to use?

No, I just made an assumption. I'm new to this so just tried what I thought would work but it didn't.

Ian230689:
No, I just made an assumption. I'm new to this so just tried what I thought would work but it didn't.

Ok so then you need to see what your hardware documentation says...

According to the Motor Shield documentation pin 13 for Channel B direction is correct. But Ch B speed control is on pin 11 NOT pin 3 (as I'm pretty sure I said ages ago). Arduino Motor Shield Rev3 — Arduino Official Store

Boring I know but I find reading the documentation often works better than just making random wild guesses.

Steve

slipstick:
According to the Motor Shield documentation pin 13 for Channel B direction is correct. But Ch B speed control is on pin 11 NOT pin 3 (as I'm pretty sure I said ages ago). Arduino Motor Shield Rev3 — Arduino Official Store

Boring I know but I find reading the documentation often works better than just making random wild guesses.

Steve

Hi steve,

I will have a read of the documentation, thanks. So would you say my code is fine? apart from Pin 3 is wrong?

Cheers

Looks reasonable apart from SOME uses of pin 3 being wrong. But why not just test it and see what it does?

Steve

slipstick:
Looks reasonable apart from SOME uses of pin 3 being wrong. But why not just test it and see what it does?

Steve

yes, that's the plane! thanks for the input, it's appreciated.

Cheers

slipstick:
Looks reasonable apart from SOME uses of pin 3 being wrong. But why not just test it and see what it does?

Steve

Hi Steve,

I have changed pin 3 to pin 11 in my code and everything is in working order. thanks again for the help. Much appreciated.

Cheers

You're very welcome. And with any luck you've decided to look at the documentation earlier from now on...it might have saved you several days.

Steve

slipstick:
You're very welcome. And with any luck you've decided to look at the documentation earlier from now on...it might have saved you several days.

Steve

Yes, I definitely will from now on! Thanks.