- Wed Feb 07, 2018 5:41 am
#198219
Hi Everybody,
I'm trying to control a brushless ESC using arduino mega but i can't findout how to set starting signal.
I'am using Racerstar RS30A Lite 30A Blheli_S BB1 2-4S Brushless ESC.
This is my code but i have no clue what's wrong:
I'm trying to control a brushless ESC using arduino mega but i can't findout how to set starting signal.
I'am using Racerstar RS30A Lite 30A Blheli_S BB1 2-4S Brushless ESC.
This is my code but i have no clue what's wrong:
Code: Select all
Probably i miss there a maximum value of signal (in normall startup proces there is needed minimum and maximum value, i have only minimum value it is what i found on internet) at the start but i don't know how to do it.#include <Servo.h>
// Servo objekt s regulátorem
Servo esc;
// Regulátor najdeme na pinu D9
int esc_pin = 9;
// Minimální hodnota pulzu
int arm = 1000;
// arm + steady = od jaké hodnoty začíná reagovat motor
int steady = 250;
void setup() {
// Připojíme Servo objekt na pin D9
esc.attach(esc_pin);
// Nastavíme pulz 1000 microsekund na výstupu
esc.writeMicroseconds(arm);
// a počkáme 1 sekundu
delay(1000);
// Regulátor by měl rozpoznat náš 1 ms pulz a tak začneme pomalu roztáčet motor
// Toto nesmíme udělat moc rychle, jinak dojde k chybovému stavu jako na videu níže
throttle_up();
}
void loop() {
int i;
// Postupně budeme do regulátoru posílat pulzy o šířce 1250 mikrosekund až 1350 mikrosekund
for(i = 0; i < 20; i++) {
esc.writeMicroseconds(arm + steady + 5 * i);
delay(500);
}
delay(2000);
// a zase motor zpomalíme
for(i = 19; i >= 0; i--) {
esc.writeMicroseconds(arm + steady + 5 * i);
delay(500);
}
delay(2000);
}
// funkce pro postupné nastavení šířky pulzu na 1250 mikrosekund
void throttle_up() {
for(int i = 0; i <= steady; i++) {
esc.writeMicroseconds(arm + i);
delay(20);
}
}