my servo won't activate when i run code however my motors run fine
what am i missing or not seeing...
// losi twin motor ESC with reverse, futaba SERVO sketch
// BY "a little bit of everyone"
#include <Servo.h>
Servo myservo1; // create servo object to control a esc
Servo myservo2; // steering servo
int pos = 90; // variable to store the servo position
int armValue=90; //"ZERO" position for arming ESC. As some wont arm with a '0' value from the arduino. (may need to experiment)
void arm() //Arming sequence of sending a minimum or 'joystick zero' for 10 seconds to simulate radio gear is ON and operational.
{
myservo1.write(armValue);
myservo2.write(pos);
delay(10000); //Delay for the ESC to activate. (may need to experiment)
}
void setup()
{
myservo1.attach(11); // attaches the esc on pin 11 to the servo object
myservo2.attach(9); // attaches the steering servo on pin 9
arm(); // Arming sequence finished
}
void loop() // remember 0 degrees is full speed reverse 90 degrees is neutral and 180 degrees is full speed foward
{
//--------------------------ESC CONTROL--------------------------------------------------------------------------------------
for(pos = 90; pos < 130; pos += 20) // goes from 90 degrees "neutral" to 130 degrees "foward speed"
{ // in steps of 20 degree
myservo1.write(pos); // tell esc to go to position in variable 'pos'
delay(30000); // waits 30 seconds for the esc to reach the position
}
for(pos = 130; pos > 90; pos-= 20) // goes from 130 degrees "foward speed" to 90 degrees "neutral"
{ // in steps of 20 degree
myservo1.write(pos); // tell esc to go to position in variable 'pos'
delay(30000); // waits 30 seconds for the esc to reach the position
}
//------------------------------SERVO STEERING------------------------------------------------------------------------------
for(pos = 0; pos < 180; pos += 20) // goes from 0 degrees to 180 degrees
{ // in steps of 20 degree
myservo2.write(pos); // tell servo to go to position in variable 'pos'
delay(5000); // waits 5 seconds for the servo to reach the position
}
for(pos = 180; pos>=0; pos-= 20) // goes from 180 degrees to 0 degrees
{ // in steps of 20 degree
myservo2.write(pos); // tell servo to go to position in variable 'pos'
delay(5000); // waits 15ms for the servo to reach the position
}
}
thanks again