Hello friends!
I look for example code for Ardunio and a 360 ° servo for studying.
Who can help?
With thanking greetings
Gerhard
Quite simple, sir
You will use the same servo commands as you normally would. You will have your #include<Servo.h>, Servo myServo and myServo.attach(pin).
In theory, if you send your servo a “centered” command (myServo.write(90)) it should stop. A number above 90 will make it go forward and a number below 90 will make it go in reverse. As these numbers move away from 90, the servo should move faster in that direction.
Now, in reality, that “centered” (off) position will rarely be 90. As a matter of fact, it can even change based on the temperature. There is no good way to do this, you just have to play around with your particular servo(s) and find their partcular center point. Your left servo might stop at 87 and your right servo might stop at 92. Just make note of these numbers where ever you keep your notes, change the numbers in your code and you should be all set.
Thanks I will try and report
Thanks I will try and report …
Gerhard
If its only 360 and not
If its only 360 and not continues, just have a look at the map command. It can help you get from 0-360 and over to 0-1023 for the servo position.
If its only 360 and not
If its only 360 and not continues, just have a look at the map command. It can help you get from 0-360 and over to 0-1023 for the servo position.
Many thanks!!!
Yes many thanks loves friends! As soon as I have time will I try it. I only still want to change the supply so that it opens with the servo
With best greetings and gratitude
Gerhard
Germany
PS: It is a servo shifting continuously
my test-code
this is my test-code :
/* ========================================================================== /
/ /
/ servo360_2x.c /
/ © 2012 Gerhard Hinze /
/ /
/ Description /
/ /
/ ========================================================================== */
#include <Servo.h>
Servo leftmotor;
Servo rightmotor;
int pwmL,pwmR;
void setup()
{
leftmotor.attach(9); // af-motorshield servo 2
rightmotor.attach(10); // af-motorshield servo 1
}
void loop()
{
leftmotor.write(pwmL + 90); // for use with continuous motor
rightmotor.write(pwmR +90);
}