Servo library problem


hi!
i testing servo motor code below , found strange behavior on servo library.

code: [select]

#include <servo.h>

servo servo;

void setup() {
  serial.begin(9600);
  servo.attach(13, 500, 2400); //[a]

  servo.write(0);
  serial.println(servo.readmicroseconds());
 
  delay(1000);
 
  servo.write(180);
  serial.println(servo.readmicroseconds());
  delay(1000);

}

void loop() {
}


i changing parameters on line 7 (indicated comment [a]) in order test motor.
at first, put parameters "servo.attach(13, 500, 2400);", serial monitor indicates 2 values, 500 , 2400. seems fine.
when parameters "servo.attach(13, 1000, 1900);", serial monitor indicates 1000 , 1900. seems still good.
but, put "servo.attach(13, 1100, 1800);", serial monitor indicates strange values, 72 , 2824.

what's happening? library's bug?

i'm using servo motor.
http://www.yinyanmodel.com/en/productview.asp?id=268
i think need set pulse width range 1500-1900. ( servo.attach(13, 1500, 1900); )
but because of problem, pulse width range set 476-1900 actually.

i'm using arduino uno , ide 1.6.9.

the instance variables min , max in servo library 8 bit ints.  record difference from
default min , max values in units of 4us, can vary each limit +/- 508us.


Arduino Forum > Using Arduino > Motors, Mechanics, and Power (Moderator: fabioc84) > Servo library problem


arduino

Comments

Popular posts from this blog

Error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode - Raspberry Pi Forums

class MPU6050 has no member named begin

missing filename after '-o'