Buenas tardes,
Estoy intentando controlar un servo mediante Arduino y simularlo con Proteus para hacer unas pruebas, pero no se que pasa, que los ejemplos que trae arduino no me funcionan... El servo se queda fijo y no se mueve. En cambio motores paso a paso si que consigo que funcionen.
Alguien que haya tenido problemas similares con proteus podria ayudarme? Supongo que debe ser que algo configuro mal.
Muchas gracias!
Estoy utilizando el siguiente código (el que viene en los ejemplos de arduino):
#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(24); // 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
}
}