0

I'm currently working on a drone project, and I have a bit of a problem. I am using a motor driver for my propellers, but the motor only runs continuously when connected to the computer. I have the battery connected via the vin and ground pins, but when I disconnect the computer the motor only moves a little bit and then turns off, then turns back on again within three seconds. So instead of running continuously, it turns on and off very quickly and repeatedly. Thank you for any help, Here's my code if it will help.

int IN1 = 2;
int ENA = 3;

void setup() {
  // put your setup code here, to run once:
  pinMode(IN1, OUTPUT);
  pinMode(ENA, OUTPUT);
  Serial.begin(9600);
  delay(1000);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(IN1, HIGH);
  analogWrite(ENA, 255);
}
8
  • 2
    What battery...? – Majenko Jan 19 at 14:21
  • I should’ve specified. It’s a nine volt battery running to both the driver and arduino. – john papp Jan 19 at 14:22
  • 1
    A little PP3 battery? – Majenko Jan 19 at 14:23
  • Um honestly I don’t know it’s the little rectangular ones with both the positive and negative ports on one side. – john papp Jan 19 at 14:25
  • Yes, that's a PP3. – Majenko Jan 19 at 14:26