Hi I have an issue with a project im seem to have messed up on, I have a set of wooden blinds that are controled via servos, untill recentley they worked fine, however they are now jittering on occations and cant work out why?
There are three servos one coe each blind. As i say untill recentley they seemed to wrok fine, I did change the jumper wires for a screw terminal connection which is when the issue started but even changing back to the jumper wires does not seem to have solved the issue. this is the code appologies if I have added it wrong.
#include <VarSpeedServo.h>
#include <IRremote.h>
int IRpin = 2; // pin for the IR sensor
IRrecv irrecv(IRpin);
decode_results results;
// create servo objects
VarSpeedServo myservo1;
VarSpeedServo myservo2;
VarSpeedServo myservo3;
void setup() {
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
myservo1.attach(9);
myservo2.attach(10);
myservo3.attach(11);
}
void loop() {
int OPEN = 70;
int CLOSE = 180;
int SPEED1 = 25;
if (irrecv.decode(&results)) {
irrecv.resume(); // Receive the next value
}
if (results.value == 16343199) // change according to your IR remote button number
{
myservo1.attach(9); // attaches the servo on pin 9 to the servo object
myservo2.attach(10); // attaches the servo on pin 10 to the servo object
myservo3.attach(11); // attaches the servo on pin 11 to the servo object
myservo1.write(OPEN, SPEED1);
myservo2.write(OPEN, SPEED1);
myservo3.write(OPEN, SPEED1);
delay(1700);
myservo1.detach(); // wait for servo 1 to finish
myservo2.detach(); // wait for servo 2 to finish
myservo3.detach(); // wait for servo 3 to finish
}
{
if (results.value == 16347279) // change according to your IR remote button number
{
myservo1.attach(9); // attaches the servo on pin 9 to the servo object
{
myservo2.attach(10); // attaches the servo on pin 10 to the servo object
{
myservo3.attach(11); // attaches the servo on pin 11to the servo object
myservo1.write(CLOSE, SPEED1);
myservo2.write(CLOSE, SPEED1);
myservo3.write(CLOSE, SPEED1);
delay(1700);
myservo1.detach(); // wait for S1
myservo2.detach(); // wait for S1
myservo3.detach(); // wait for S1
delay(100);
}
}
}
}
}