DC Gear Motor,Arduino Uno R3 and Arduino Motor SHield Rev3

Hi dear members,

I have simple question and I hope there will be a simple answer .:slight_smile: I wanna this motor work 10 seconds to left then 10 sec to right. That only be needed for 2-3 mins top in every 3 hours. Is there any program that I can copy paste it?

First find a simple example for the motor shield - get that working - your requirements
are simple and should be obvious from that point, or if not come back with the example
code so we've something to work with?

This will be my basic program for DC Motor. I will a little bit upgrade this program with Delay and Pin HIGH and LOW.

I will write my last version of this and be glad if you can check it later. Thanks again.

Is this program ok for my purpose?

const int
PWM_A = 3,
YON_A = 12,
FREN_A = 9,
SNS_A = A0;

void setup() {

pinMode(FREN_A, OUTPUT);
pinMode(YON_A, OUTPUT);

}

void loop() {

digitalWrite(FREN_A, LOW);
digitalWrite(YON_A, HIGH);
analogWrite(PWM_A, 255);

delay(5000);

digitalWrite(FREN_A, HIGH);
delay(5000);

digitalWrite(FREN_A, LOW);
digitalWrite(YON_A, LOW);
analogWrite(PWM_A, 255);

delay(5000);

analogWrite(PWM_A, 0);

while(1);