Confusion about Arduino Sweep code


i compiled code found http://arduino.cc/en/tutorial/sweep.
the code is:
code: [select]

// sweep
// barragan <http://barraganstudio.com>
// example code in public domain.


#include <servo.h>

servo myservo;  // create servo object control servo
                // maximum of 8 servo objects can created

int pos = 0;    // variable store servo position

void setup()
{
  myservo.attach(9);  // attaches servo on pin 9 servo object
}


void loop()
{
  for(pos = 0; pos < 180; pos += 1)  // goes 0 degrees 180 degrees
  {                                  // in steps of 1 degree
    myservo.write(pos);              // tell servo go position in variable 'pos'
    delay(15);                       // waits 15ms servo reach position
  }
  for(pos = 180; pos>=1; pos-=1)     // goes 180 degrees 0 degrees
  {                               
    myservo.write(pos);              // tell servo go position in variable 'pos'
    delay(15);                       // waits 15ms servo reach position
  }
}


what confused delay function. in above code, motor goes 0 180 degrees 1 degree (off topic, why go 1 degrees , not 0?) in total of 30ms. 30ms should period, in 1 second there should 1/(30*10^-3) cycles, not seem it's doing on servo motor. 
i using servo http://www.readyheli.com/rc-mks-hbl980-high-voltage-hi-speed-brushless-tail-servo-p-38632.html.
does know causing problem?

the delay(15) in 2 loops.

so total of 360x15 ms


Arduino Forum > Using Arduino > Project Guidance > Confusion about Arduino Sweep code


arduino

Comments

Popular posts from this blog

Convierte tu Raspberry en un NAS. Firmware fvdw-sl 15.3 - Raspberry Pi Forums

How to format a Get Request

avrdude: verification error, first mismatch at byte 0x0000 0x0c != 0x62