Hi everyone. My name is Emi. Yesterday i had a problem with this 2 shields, that i couldn’t program to run 2 motors. I think the problem is with the pins outputs, seems like there are differences between Arduino Duemilanove and Seeduino Stalker v2.0 when comes to PWM pins. I am saying this because i used the same sketch (the Ardumoto sketch - it is on the internet) on Arduino and works okay, but not with the Seeeduino Stalker. The Stalker works okay, uploads the sketches with no probem, but still my question is, where to modify the code, so i can use the Ardumoto shield with Seeeduino Stalker ?
Please if anyone knows, i beg you to tell me. All suggestions are welcome.
Best regards Byemi.
Have a nice day.
This is the sketch :
int pwm_a = 3; //PWM control for motor outputs 1 and 2 is on digital pin 3
int pwm_b = 11; //PWM control for motor outputs 3 and 4 is on digital pin 11
int dir_a = 12; //direction control for motor outputs 1 and 2 is on digital pin 12
int dir_b = 13; //direction control for motor outputs 3 and 4 is on digital pin 13
int val = 0; //value for fade
void setup()
{
pinMode(pwm_a, OUTPUT); //Set control pins to be outputs
pinMode(pwm_b, OUTPUT);
pinMode(dir_a, OUTPUT);
pinMode(dir_b, OUTPUT);
analogWrite(pwm_a, 100); //set both motors to run at (100/255 = 39)% duty cycle (slow)
analogWrite(pwm_b, 100);
}
void loop()
{
forw(); //Set Motors to go forward Note : No pwm is defined with the for function, so that fade in and out works
fadein(); //fade in from 0-255
delay(1000);
forward(); //continue full speed forward
delay(1000);
fadeout(); //Fade out from 255-0
delay(1000); //Wait one second
stopped(); // stop for 2 seconds
delay(2000);
back(); //Set motors to revers. Note : No pwm is defined with the back function, so that fade in and out works
fadein(); //fade in from 0-255
delay(1000);
backward(); //full speed backward
delay(1000);
fadeout(); //Fade out from 255-0
delay(1000);
}