Tutorial.Sweep History

Hide minor edits - Show changes to markup

June 01, 2010, at 10:26 PM by Equipo Traduccion -
Changed lines 1-14 from:

Examples > Servo Library

Sweep

Description

Sweeps the shaft of a servo motor back and forth.

Circuit

Servo motors have three wires: power, ground, and signal. The power wire is typically red, and should be connected to the 5V pin on the Arduino board. The ground wire is typically black or brown and should be connected to a ground pin on the Arduino board. The signal pin is typically yellow, orange or white and should be connected to pin 9 on the Arduino board.

Code

to:

Ejemplo > Librería Servo

Barrido

Descripción

Mueve el eje del servo motor de un lado al otro.

Circuito

Los servo motores poseen tres terminales: alimentación, masa y señal. El terminal de alimentación, es normalmente rojo,y se debe conectar al pin 5V de la placa Arduino. El terminal de masa el cual es normalmente negro debe de conectarse a el pin de masa del la placa Arduino. El cable de señal suele ser amarillo, naranja o blanco y debe conectarse al pin 9 de la placa Arduino.

Código

Changed lines 18-19 from:

// by BARRAGAN <http://barraganstudio.com>

to:

// por BARRAGAN <http://barraganstudio.com>

Changed lines 22-24 from:

Servo myservo; // create servo object to control a servo

int pos = 0; // variable to store the servo position

to:

Servo myservo; // crea un objeto tipo servo para controlar el servo

int pos = 0; // variable para almacenar la posición del servo

Changed line 28 from:
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object 
to:
  myservo.attach(9);  // liga el servo conectado en el pin 9 al objeto servo
Changed lines 33-36 from:
  for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees 
  {                                  // in steps of 1 degree 
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
to:
  for(pos = 0; pos < 180; pos += 1)  // va de 0 a 180 grados
  {                                  // en pasos de 1 grado 
    myservo.write(pos);              // dice al servo que se posicione en la posición indicada por la variable 'pos'
    delay(15);                       // espera 15 ms para dar tiempo al servo a llegar a la nueva posición 
Changed line 38 from:
  for(pos = 180; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees 
to:
  for(pos = 180; pos>=1; pos-=1)     // va de 180 a 0 grados
Changed lines 40-41 from:
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
to:
    myservo.write(pos);              // dice al servo que se posicione en la posición indicada por la variable 'pos'
    delay(15);                       // espera 15 ms para dar tiempo al servo a llegar a la nueva posición 
Changed lines 46-48 from:
to:
October 17, 2008, at 05:29 PM by Paul Badger -
Changed lines 11-12 from:

Servo motors have three wires: power, ground, and signal. The power wire is typically red, and should be connected to the 5V pin on the Arduino board. The ground wire is typically black or brown and should be connected to a ground pin on the Arduino board. The signal pin is typically yellow or orange and should be connected to pin 9 on the Arduino board.

to:

Servo motors have three wires: power, ground, and signal. The power wire is typically red, and should be connected to the 5V pin on the Arduino board. The ground wire is typically black or brown and should be connected to a ground pin on the Arduino board. The signal pin is typically yellow, orange or white and should be connected to pin 9 on the Arduino board.

October 12, 2008, at 12:02 AM by David A. Mellis -
Changed lines 22-23 from:
                // a maximum of eight servo objects can be created 
to:

int pos = 0; // variable to store the servo position

Deleted lines 24-25:

int pos = 0; // variable to store the servo position

Deleted line 29:
October 11, 2008, at 11:59 PM by David A. Mellis -
Added lines 1-49:

Examples > Servo Library

Sweep

Description

Sweeps the shaft of a servo motor back and forth.

Circuit

Servo motors have three wires: power, ground, and signal. The power wire is typically red, and should be connected to the 5V pin on the Arduino board. The ground wire is typically black or brown and should be connected to a ground pin on the Arduino board. The signal pin is typically yellow or orange and should be connected to pin 9 on the Arduino board.

Code

// Sweep
// by BARRAGAN <http://barraganstudio.com> 

#include <Servo.h> 

Servo myservo;  // create servo object to control a servo 
                // a maximum of eight servo objects can be created 

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() 
{ 
  for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees 
  {                                  // in steps of 1 degree 
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
  for(pos = 180; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees 
  {                                
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
} 

See also

Share