I have renbotics ServoShield and I have made a code on arduino where from serialport I can send commads to servos and it happens with that way... S01P1200,S14P2300etc..I mean that Servo 1 to 1200 posion and servo 14 to 2300 posion
NowI have one problem.How can I control the servo's speed from serial port? For example S01P1200F.... 1 SERVO, 1200 POSION, F = SPEED...Is there any code for controlling servos speed so that I can take it and include it into my code? As I know servoshield 1.5 library I use , can't support any speed control.
My code that moves servo is this , but how can I contol the speed?o you have any clue?
I went to renbotics.com, and, looked at both of their shields. The manuals for both shields tell exactly what the libraries that come with the shields can do.
You can:
void setposition(int servo, int position); int setbounds(int servo, int minposition, int maxposition); int getposition(int servo); int invertservo(int servo);
As Bajdi said, the only way to control the speed would be to control how far you tell the servo to move each time, and, how quickly it should change its position.
goodmorning my friend Yes but I have this code and I can contol the speed for all 16 servos…But in this case I give first position and the next where it should be moved…In my case I am sending you from serial port ,how do you think I could write this code(I will have many first and last positions for servos) with first command S00P1200,S09P1350,S10P0960,S15P1800 and the last goes to S00P2350,S09P0600,S10P2400,S15P0960 for example Servo 0 first pos 1200us and last pos 2350us</p><p>Servo 9 first pos 1350us and last pos 600us Servo 10 first pos 960us and last pos 2400us servo 15 first pos 1800us and last post 960us
i have this code
void loop() { const int angleIncrement =10; const int incrementDelay = 10; for (int angle = 700; angle < 2400; angle += angleIncrement) { for (int i = 0; i < 16; i++) servos.setposition (i,angle); delay (incrementDelay); // so we’ll take 10 * 180 milliseconds = 1.8 seconds for the traverse. } }
goodmorning my friend Yes but I have this code and I can contol the speed for all 16 servos…But in this case I give first position and the next where it should be moved…In my case I am sending you from serial port ,how do you think I could write this code(I will have many first and last positions for servos) with first command S00P1200,S09P1350,S10P0960,S15P1800 and the last goes to S00P2350,S09P0600,S10P2400,S15P0960 for example Servo 0 first pos 1200us and last pos 2350us</p><p>Servo 9 first pos 1350us and last pos 600us Servo 10 first pos 960us and last pos 2400us servo 15 first pos 1800us and last post 960us
i have this code
void loop() { const int angleIncrement =10; const int incrementDelay = 10; for (int angle = 700; angle < 2400; angle += angleIncrement) { for (int i = 0; i < 16; i++) servos.setposition (i,angle); delay (incrementDelay); // so we’ll take 10 * 180 milliseconds = 1.8 seconds for the traverse. } }
Below is your code to sweep the servos from 700 to 2400. In this sketch, you have a variable called “incrementDelay”. If this variable is 0, it is full speed, if it is a bigger number, it is slower. That is your speed control.
void loop() { const int angleIncrement =10; const int incrementDelay = 10; for (int angle = 700; angle < 2400; angle += angleIncrement) { for (int i = 0; i < 16; i++) servos.setposition (i,angle); delay (incrementDelay); <------ Make this bigger to go slower }
Yes my friend, but i have 2 problems… ths first problem is ,to angleIncrement! if i can 1 step, and delay 1 have the half posion in the right speed… but, i change the incrementDelay to 5 sec, i have full posion but is slow…!
the second problem, if i can to angleIncrement 10 an delay 1 sec, i have speed but 1/4 posion, and if i can change to 10 i have normal speed, full posion, but if i can the incrementDelay 50 , is slow but the speed no smooth, is step step step…
I would like to know how to control speed the VarSpeedServo library… the method… this library is very good…I have slow and smooth speed… and fast and foul posion!!! but this is for arduino pin
I send from serial port, posion for example : #00P1831… this code with 10 angleIncrement for normal speed the problem is how can it goes to servo 1831 -->“1” ms