Thanks for the advice. That is the magic word "writemicroseconds".
With "1" means that the right rotor:
With "2" means that the left rotor:
#include <Servo.h>
Servo motorCW1;
Servo motorCW2;
#define PIN_CW1 5
#define PIN_CW2 6
void esc()
{
delay(5000);
Serial.println("Sending lowest throttle CW1");
motorCW1.writeMicroseconds(1000);
delay(2000);
Serial.println("Sending lowest throttle CW2");
motorCW2.writeMicroseconds(1000);
delay(2000);
Serial.println("Low throttle sent");
}
void setup() {
Serial.begin(9600);
motorCW1.attach(PIN_CW1);
motorCW2.attach(PIN_CW2);
Serial.println("ESC calibration started");
esc();
Serial.println("ESC calibration completed");
}
void loop() {
if (Serial.available() > 0)
{
int key = Serial.read();
switch(key)
{
case '1':
motorCW1.writeMicroseconds(1050);
// motorCW2.writeMicroseconds(1050);
Serial.println("1050");
delay(2000);
break;
case '2':
// motorCW1.writeMicroseconds(1100);
motorCW2.writeMicroseconds(1100);
Serial.println("1100");
delay(2000);
break;
case '6':
motorCW1.writeMicroseconds(1000);
motorCW1.writeMicroseconds(1000);
Serial.println("1000");
delay(1000);
break;
default:
motorCW1.writeMicroseconds(1000);
motorCW2.writeMicroseconds(1000);
Serial.println("1000");
break;
}
}
}
If I turn in "Case 1" CW2, the rotors spin very fast. Why is that?
Regards Kucky