Arduino Forum

Using Arduino => Motors, Mechanics, and Power => Topic started by: manibh on Feb 13, 2011, 02:20 pm

Title: Arduino Uno - can't use DC motors + Servo motor
Post by: manibh on Feb 13, 2011, 02:20 pm
Hi every one,

I am trying to use drive shield (based on L298NH).
my program is working well for stand alone servo or stand alone dc.
But I can't have my DC and servo together, I don't know why id I put following line in setup dc motors will not work any more:

but if i comment it out they will work.
here is my full sketch:

const int dir1PinA = 13;
const int dir2PinA = 12;
const int speedPinA = 10;

// motor B
const int dir1PinB = 11;
const int dir2PinB = 8;
const int speedPinB = 9;

const int servoPin=3;

void setup() {
  pinMode(dir1PinA, OUTPUT);
  pinMode(dir2PinA, OUTPUT);
  pinMode(speedPinA, OUTPUT);
  pinMode(dir1PinB, OUTPUT);
  pinMode(dir2PinB, OUTPUT);
  pinMode(speedPinB, OUTPUT);

void loop() {
  analogWrite(10, 200);
  digitalWrite(12, HIGH);
//    servoScan(scanDegreeFrom, scanDegreeTO, scanDegreeStepping, servoScanDelay);

please help me with this issue.   :~
Is there any one who was able to use servo + dc motors using L298HN shield?

Many thanks,