Hello
i've been trying to control brushless motors with a simple code with arduino, when i run the following code nothing happens, the motors do not start
/////////////////
#include <Servo.h>
Servo m1;
Servo m2;
void setup() {
Serial.begin(9600);
m1.attach(5);
m2.attach(7);
m1.writeMicroseconds(1000);
m2.writeMicroseconds(1000);
delay(1000);
}
void loop() {
m1.writeMicroseconds(1150);
m2.writeMicroseconds(1150);
delay(1000);
m1.writeMicroseconds(1200);
m2.writeMicroseconds(1200);
delay(1000);
m1.writeMicroseconds(1150);
m2.writeMicroseconds(1150);
delay(1000);
m1.writeMicroseconds(1100);
m2.writeMicroseconds(1100);
delay(1000);
/////////////////////////////
but when i run this code by adding the last 3 lines to the code : (m1.writeMicroseconds(1000)..)
it works perfectly.
#include <Servo.h>
Servo m1;
Servo m2;
void setup() {
Serial.begin(9600);
m1.attach(5);
m2.attach(7);
m1.writeMicroseconds(1000);
m2.writeMicroseconds(1000);
delay(1000);
}
void loop() {
m1.writeMicroseconds(1150);
m2.writeMicroseconds(1150);
delay(1000);
m1.writeMicroseconds(1200);
m2.writeMicroseconds(1200);
delay(1000);
m1.writeMicroseconds(1150);
m2.writeMicroseconds(1150);
delay(1000);
m1.writeMicroseconds(1100);
m2.writeMicroseconds(1100);
delay(1000);
m1.writeMicroseconds(1000);
m2.writeMicroseconds(1000);
delay(1000);
}
the problem is that i can not use that line(turn the motor off by sending 1000 ) in an other program which requires the continuous running of the motor, so is there any suggestion to what i might be doing wrong ? or a solution to this problem ?
Thank you
i've been trying to control brushless motors with a simple code with arduino, when i run the following code nothing happens, the motors do not start
/////////////////
#include <Servo.h>
Servo m1;
Servo m2;
void setup() {
Serial.begin(9600);
m1.attach(5);
m2.attach(7);
m1.writeMicroseconds(1000);
m2.writeMicroseconds(1000);
delay(1000);
}
void loop() {
m1.writeMicroseconds(1150);
m2.writeMicroseconds(1150);
delay(1000);
m1.writeMicroseconds(1200);
m2.writeMicroseconds(1200);
delay(1000);
m1.writeMicroseconds(1150);
m2.writeMicroseconds(1150);
delay(1000);
m1.writeMicroseconds(1100);
m2.writeMicroseconds(1100);
delay(1000);
/////////////////////////////
but when i run this code by adding the last 3 lines to the code : (m1.writeMicroseconds(1000)..)
it works perfectly.
#include <Servo.h>
Servo m1;
Servo m2;
void setup() {
Serial.begin(9600);
m1.attach(5);
m2.attach(7);
m1.writeMicroseconds(1000);
m2.writeMicroseconds(1000);
delay(1000);
}
void loop() {
m1.writeMicroseconds(1150);
m2.writeMicroseconds(1150);
delay(1000);
m1.writeMicroseconds(1200);
m2.writeMicroseconds(1200);
delay(1000);
m1.writeMicroseconds(1150);
m2.writeMicroseconds(1150);
delay(1000);
m1.writeMicroseconds(1100);
m2.writeMicroseconds(1100);
delay(1000);
m1.writeMicroseconds(1000);
m2.writeMicroseconds(1000);
delay(1000);
}
the problem is that i can not use that line(turn the motor off by sending 1000 ) in an other program which requires the continuous running of the motor, so is there any suggestion to what i might be doing wrong ? or a solution to this problem ?
Thank you