I am trying to create a small simulation using 2 small DC motors with the Elegoo 2560 and accompanying 9V power supply connected to a breadboard. I can get one motor to work, however when I connect the second both start to hum (low voltage hum). I am also using an L293D so I am sure the problem is in the connections and code. I am new to all of this so any help would be great.
This is the code (Modified from the Elegoo Tutorial) I am using and the current setup.
//Working first motor
#define ENABLE 5
#define DIRA 3
#define DIRB 4
//Second Motor Test
#define ENABLE 8
#define DIRA 9
#define DIRB 10
int i;
void setup() {
//---set pin direction
pinMode(ENABLE,OUTPUT);
pinMode(DIRA,OUTPUT);
pinMode(DIRB,OUTPUT);
Serial.begin(9600);
}
void loop() {
Serial.println("PWM full then slow");
//---PWM example, full speed then slow
analogWrite(ENABLE,255); //enable on
digitalWrite(DIRA,HIGH); //one way
digitalWrite(DIRB,LOW);
delay(2000);
}
