I am working on a project that will control my window blinds depending on the input of a LDR. e.g If it is light outside the blinds will open, if it is dark outside the blinds will shut. There isn't a lot of code out there for controlling servos so I have had to take bits n pieces from various sources. To test the servo I need to have it spinning for so many seconds CW.. pause for so many seconds.. then spin CCW for so many seconds. This is to check how long it will take to open/shut them. I am using a modified servo that spins 360 continuous.
This is what I have, but the delay doesn't seem to work.
#include <Servo.h>
Servo servo;
void setup()
{
servo.attach(10);
}
void loop()
{
bbservo_move(6000, 70);
delay(3000);
bbservo_move(2600, 110);
delay(3000);
}
void bbservo_ccw_move(int duration, int velocity)
{
for (int i=velocity; i <=80 ; i++){
servo.write(i);
delay(3000);
}
}
void bbservo_cw_move(int duration, int velocity)
{
for (int i=velocity; i >=90 ; i--){
servo.write(i);
delay(3000);
}
}
void bbservo_move(int duration, int velocity)
{
servo.write(velocity);
delay(3000);
}
Any help would be appreciated.
Cheers