DC Brushed Motor Not Running Correctly

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
odonohoe
 
Posts: 21
Joined: Wed Mar 09, 2016 8:37 pm

Re: DC Brushed Motor Not Running Correctly

Post by odonohoe »

Dear Support , thank you for the information. I am using a circuit constructed on a breadboard with a transister and a diode. Do you think that this is okay for driving a DC motor in one direction with a 9 volt battery? thanks

User avatar
odonohoe
 
Posts: 21
Joined: Wed Mar 09, 2016 8:37 pm

Re: DC Brushed Motor Not Running Correctly

Post by odonohoe »

Code: Select all

#include <Servo.h>
Servo esc;

int arm = 1000
int speedvalue;
int steady = 300
int initiate = 0


void setup() {
  // put your setup code here, to run once:
esc.attach(6);
esc.writeMicroseconds(arm);
delay(2000);
esc.writeMicroseconds(1200);
delay(15);
esc.writeMicroseconds(1300);
delay(15);
}

void loop() 
  // put your main code here, to run repeatedly:
if(initiate<1{
  throttleUp();
  initiate = 1;
}
esc.detach();
}

Dear Support, This is a second attempt to run a brushless dc motor with an ESC throttling up and down once but I still have errors which did not copy as follows:
1. expected unqualified id before numeric constant
2. expected , or ; before "int"
3. expected initializer before "if"
4. "esc" does not name a type
5. expected declaration before } token Thanks if you can help

User avatar
adafruit_support_bill
 
Posts: 88154
Joined: Sat Feb 07, 2009 10:11 am

Re: DC Brushed Motor Not Running Correctly

Post by adafruit_support_bill »

Do you think that this is okay for driving a DC motor in one direction with a 9 volt battery? thanks
That depends on the motor and what kind of performance and run time you expect.

In general, 9v batteries are a poor power source for motors. They have relatively low capacity and a very high internal resistance, so they drain quickly and do not perform well with high current loads.

User avatar
adafruit_support_bill
 
Posts: 88154
Joined: Sat Feb 07, 2009 10:11 am

Re: DC Brushed Motor Not Running Correctly

Post by adafruit_support_bill »

...but I still have errors...
C++ statements require a semicolon terminator. The semicolon is missing on several of these statements.

Code: Select all

int arm = 1000
int speedvalue;
int steady = 300
int initiate = 0
And your loop function is not correctly formed. All of the statements in a function need to be inside the braces { } that define the scope of the function.

User avatar
masha
 
Posts: 7
Joined: Thu Mar 16, 2017 9:36 am

Re: DC Brushed Motor Not Running Correctly

Post by masha »

Dear Support, Can an esc and brushless motor in a quad copter kit be programmed to run off an arduino uno for autonomous not RC control without flashing the firmware on the esc?

User avatar
adafruit_support_bill
 
Posts: 88154
Joined: Sat Feb 07, 2009 10:11 am

Re: DC Brushed Motor Not Running Correctly

Post by adafruit_support_bill »

@masha - Better to start a new thread for this question,

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”