Hello,
For my project I need the following motors:
2 DC motors (using L298N)
1 x 360 servo
2 or 3 stepper motors (using CNC v3 shield)
For now I'm testing the DC motors and servo. I tested the DC motors and servo separately and they worked fine! But when I try to control both, it doesn't work anymore.
Please see my code below:
#include <Servo.h>
//Setup Motor Pins
#define in1 44 //PWM pin.
#define in2 45 //PWM pin.
Servo myservo;
int lowSpeed = 2;
int maxSpeed = 250;
void setup() {
//set the pins for output
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
myservo.attach(46);
}
void loop() {
myservo.write(100);
analogWrite(in1, maxSpeed);
analogWrite(in2, maxSpeed);
}
Because I'm also using the CNC shield, I only have 44/45/46 left.
Please advice on how I can drive both,
Roy