Sorry in advance as I'm still a rookie with Arduino projects. My goal is to use an Arduino Uno 3 to create an inexpensive drone/plane project.
Here are my materials and my set up:
- A2212 1000kv Brushless Motor
- HW30A Brushless Motor Speed Controller (ESC)
- Arduino Uno R3
- bunch of cables
- 9 V battery
Upon compiling the code I found here and connecting the 9 V battery to the ESC, all I hear is constant beep sounds from the motor (about once every 1.5 seconds). Can anyone help me figure out what's going on? Is it the 9 V battery that's not giving the motor enough juice? Or am I just too silly hoping to create something that works under $10?
#include <Servo.h>
Servo ESC1;
int pos = 0; //Sets position variable
void arm() {
setSpeed(0); //Sets speed variable delay(1000);
}
void setSpeed(int speed){
int angle = map(speed, 0, 100, 0, 180);
//Sets servo positions to different speeds ESC1.write(angle);
}
void setup() {
ESC1.attach(9); //Adds ESC to certain pin. arm();
}
void loop() {
int speed; //Implements speed variable
for(speed = 0; speed <= 70; speed += 5) {
//Cycles speed up to 70% power for 1 second
setSpeed(speed);
//Creates variable for speed to be used in in for loop
delay(1000);
}
delay(4000); //Stays on for 4 seconds
for(speed = 70; speed > 0; speed -= 5) {
// Cycles speed down to 0% power for 1 second
setSpeed(speed); delay(1000);
}
setSpeed(0);
//Sets speed variable to zero no matter what
delay(1000);
//Turns off for 1 second
}


