Hallo,
ich hoffe ihr könnt mir helfen. Mein Latein ist ziemlich am Ende. ![]()
Ich habe folgenden ESC: http://www.conrad.de/ce/de/product/207368/Modelcraft-Carbon-Series-Fahrtregler-Belastbarkeit-60-A-50-A-35-A-Motorlimit-20-Turns/SHOP_AREA_32305
und einen 540er Motor daran angeschlossen an einem Arduino Mega 2650.
Kurz die Daten:
Ausführung 20 Turn
Betriebsspannung 7.2 - 8.4 V
Dauer-Strom 35 A
Motorlimit 20 Turns
Abm. (L x B x H) 35 x 29 x 27 mm
Gewicht 48 g
Zellenzahl NiCd/NiMH 6 - 7
Taktfrequenz 1.0 kHz
Stecksystem JR / Futaba
BEC-Daten 5 V/1 A
Belastbarkeit (1s/30 s/5 min) 60 A / 50 A / 35 A
Vorwärts/Rückwärts/Bremse Ja / Ja / Ja
Es läuft alles soweit. Die Kallibrierung des ESC funktioniert und der Motor dreht sich auch.
Hier der Code ( ist nicht von mir ):
#include <Servo.h>
Servo esc; // Define the ESC as a servo object
int arm = 1000; // defines pulse width of 1000 us int speedvalue; int steady = 300; int initiate = 0;
int speedvalue;
int steady = 300;
int initiate = 0;
void setup()
{
esc.attach(26);
esc.writeMicroseconds(arm);
}
void loop()
{
/*
Calls a sub to throttle up motor from 0 rpm to a steady running value.
The if statement is used to run the throttle up once.
*/
if (initiate < 1){
throttleUp();
initiate = 1;
}
/*
You can then change the speed in the main loop by changing the pulse width.
If nothing else is going on in the loop, a delay must be included otherwise the servo writeMicroseconds is called to fast and there is not the proper time delay between pulses (I think this is the case...need to check this on a scope. The minimum delay is 15 ms. The lines below use a 1 second delay between speed settings. The loop also causes this to be run once */
if (initiate < 2){
for (int count = 0; count < 3; count++){
speedvalue = speedvalue+10;
esc.writeMicroseconds(speedvalue);
delay(1000);
}
initiate = 2;
}
esc.detach(); // Disengage ESC from pin
}
//**************************************************
void throttleUp(){
speedvalue = arm;
for (int count = 0; count < steady; count++){
esc.writeMicroseconds(speedvalue);
speedvalue = speedvalue + 1;
delay(15);
}}
Was ich nicht hinbekomme ist, daß sich der Motor permanent dreht und nicht nach einige Sekunden ( delay() ) anhält.
Er soll immer laufen bis der Abstandssensor ein Hindernis sieht bzw. die Distanz zu gering ist.
Es geht mir nur darum das der Motor immer läuft ohne anzuhalten.
Ich habe es mit diesen Code probiert, aber der Motor dreht sich nicht. Es passiert nichts.
Die LED des ESC leuchtet kurz Grün auf und danach ist er sofort wieder Rot.
#include <Servo.h>
Servo esc; // Define the ESC as a servo object
int arm = 1000; // defines pulse width of 1000 us int speedvalue; int steady = 300; int initiate = 0;
int speedvalue;
int steady = 300;
int initiate = 0;
void setup()
{
esc.attach(26);
esc.writeMicroseconds(arm);
}
void loop()
{
if (initiate < 1){
throttleUp();
initiate = 1;
}
initiate = 1;
if (initiate < 2){
speedvalue = 1250;
esc.writeMicroseconds(speedvalue);
}
}
//**************************************************
void throttleUp(){
speedvalue = arm;
for (int count = 0; count < steady; count++){
esc.writeMicroseconds(speedvalue);
speedvalue = speedvalue + 1;
delay(15);
}}
So sieht das Teil aus an dem ich momentan schraube:
Ich hoffe ihr könnt mir weiterhelfen.
Danke und Gruss
Konstantin
