Arduino + shield motot control

Hello,

Probably a bit of a long shot. I want to be able to control the speed of a motor with a potentiometer and use one tactile button to put the motor forward, one for stop and one for backward. Is this possible with the arduino Uno and the Adafruit motor shield for one Dc motor.

Many Thanks

Jamie

Yes, that should be possible if the motor shield leaves you two available analog pins for reading button presses and pot values.

You need an analog pin to read the potentiometer, but buttons are handled by digital inputs.

Actually your requirement is quite typical and is a 'short shot' :slight_smile:

I was thinking of Arduino Playground - AnalogButtons but digital works too.

Hello,

Thank you for your replys. How would I actually do this then please

Many Thanks

Jamie

Do you have the Adafruit motor shield version 1.2, or version 2.0? They're a bit different.

Hello,

I think mine is version 1.2 but i'm not too sure.

Many Thanks

Jamie

Well the 1.2 version uses up a lot of pins, looks like it leaves 7 available though which is enough for what you want.

You'll need to determine exactly which shield you have before writing code, though -- the 1.2 version uses the "AFMotor Library" while version 2 uses "Adafruit Motorshield v2 Library".

You can use digitalRead() for the buttons with software or hardware (capacitor) debounce. You'll use analogRead() for the pot.

Then based on these inputs you'll send the appropriate commands to the library.