martes, 3 de mayo de 2016

Servo con Arduino - Parte 01

/* CODIGO SERVO001 */

#include <Servo.h>

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

int potpin = 0;        // analog pin used to connect the potentiometer
int val;               // variable to read the value from the analog pin

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

void loop()
{
  miServo.write(90);   // sets the servo position according to the scaled value
  delay(15);           // waits for the servo to get there
}


No hay comentarios:

Publicar un comentario