Pages: [1]   Go Down
Author Topic: Ardu motor shield Doesnt Work without cable connec  (Read 595 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello, I am using a ardumoto, and have the program from sparkfun.
The program downloads using a serial cable, but it will not run without the serial cable being plugged in. I have a lithium backpack attached to it. I am using the Arduino Duemilanove. Please help. The code I am using is below:
//int pwm_a = 10; //PWM control for motor outputs 1 and 2 is on digital pin 10
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


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()
{
digitalWrite(dir_a, LOW); //Set motor direction, 1 low, 2 high
digitalWrite(dir_b, LOW); //Set motor direction, 3 high, 4 low

delay(1000);

analogWrite(pwm_a, 255); //set both motors to run at 100% duty cycle (fast)
analogWrite(pwm_b, 255);

delay(1000);

digitalWrite(dir_a, HIGH); //Reverse motor direction, 1 high, 2 low
digitalWrite(dir_b, HIGH); //Reverse motor direction, 3 low, 4 high

delay(1000);

analogWrite(pwm_a, 100); //set both motors to run at (100/255 = 39)% duty cycle
analogWrite(pwm_b, 100);

delay(1000);
}
Logged

Hyderabad , India
Offline Offline
God Member
*****
Karma: 6
Posts: 621
can't help not to think arduinaizing something !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The program downloads using a serial cable, but it will not run without the serial cable being plugged in.
if by download you mean run's using a serial cable then it should be runnng when powered from a backpack as well just check your battery( i.e if its dead) continuity of the wire polarity Etc..
Logged

Austin, TX
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6146
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Even though this isn't a code issue, when posting code please press the button in the editor.

How are you connecting the battery pack to the Arduino?  What is the Nominal Voltage of the battery pack?  What is the voltage while connected?  (The 2nd question is important because "unloaded" measurements of a battery's voltage are usually meaningless.)
« Last Edit: December 17, 2010, 12:21:11 am by cmiyc » Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 620
Posts: 33991
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I am using the Arduino Duemilanove.

So there is a jumper next to the USB socket that controls if the power is taken from the USB lead or the on board regulator. Have you changed that over?
« Last Edit: December 17, 2010, 04:27:17 am by Grumpy_Mike » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 611
Posts: 49092
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
So there is a jumper next to the USB socket that controls if the power is taken from the USB lead or the on board regulator.
Not on any of my Duemilanoves, there isn't. That jumper was replaced with an auto-selection capability.
Logged

Pages: [1]   Go Up
Jump to: