You don't need an ESC, just make sure you use a separate supply (join the grounds) and drive the signal (white, usually) wire using one of the Arduino pins, with an appropriate servo library.
have a look in the libraries section for example code.
I did but did not understand how to do what I need to do. They have examples on how to drive the servo using a potentiometer, that is completely different from what I need. I need arduino to tell the servo to move 30 degress, wait 9 seconds, move back 30 degrees, wait for 9 sec, and repeat.
The example simply took the input from a pot (0..1023), mapped that range to an angle (0..180) and wrote that angle to a servo object.
Cut out the pot, substitute some angle constants, add a few "delay" calls, and your program is written.
Could I ask you to please write that code for me? Like I said, I do not know this stuff and it's seriously confusing for me. You explain it to me as if it is very simple, and it probably is, I just don't know the basics. ;D
Thank you for this. How do you assign the pin for the servo signal though in the code? And does it have to be a digital or analog pin? I thank you once again. If you do not wish to answer, I guess I'll just have to spend some more time analyzing the tutorials.
Alright, so to develop on this, my next question >>> Is there a way to make the servo move through the 30 degrees smoothly or more slowly?
Here's the complete code that I am using.
#include <Servo.h>
Servo myservo; // create servo object to control a servo
int pos = 0; // variable to store the servo position
void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop ()
{
myservo.write (30); // move servo 30 degrees
delay (1000 * 9); // wait 9 seconds
myservo.write (0); //moves servo back 30 degrees
delay (1000 * 9); // wait 9 seconds.
}
what if I add more statements, such as 2 or 3 more saying to increase by 10 degrees, wait for 100ms and then increase again, and same for when decreasing. Hmmm, will try now, any other ideas welcome
Thanks, I just changed the comments in my code ;D . Looping, I guess I'll have to learn it as well, expect more questions if I get another funny idea for arduino
Now that one I do not understand, maybe yet, but if you wish to expand on that, you are welcome. On the other hand, yes, it does feel good, but you did give me those 4 lines on which I expanded on. Thanks.
the condition for continuing the loop (performed at the start of every loop)
an action or actions to be performed at the end of the loop
the body of the loop
So, to print the numbers 1..10
// initialise condition end of loop action
for (int number = 1; number <= 10; number = number + 1) {
// body of loop
Serial.println (number);
}
// rest of sketch
a) So, declare a variable "number" and set it to 1.
b) Test if "number" is less than or equal to 10. if not, go to f)
c) if it is, print its value
d) add one to "number" (there are shorter ways of doing this)
e) goto b)
f) rest of sketch