Hello,
I'm a newbie at arduino and I'm having an issue with my project.
I'm controling a modified servo for continuous rotation with my arduino uno and a IR remote. The project is to make a clock for a theater play. The clock will quickly move forward or backward to do a "time travel"
The project is working but only for a random time period (10min to several hours) the motor doesn't move anymore. My code is not very clean but I tried several modification to check is a specific part was the issue without success. The easy way is to do a hard reset on the board or manually plugin/unpluging the servo. The arduino is powered with a 12V 1.5A DC power. I also must says that my soldering on the servo was not very clean...
I first tought the servo attach and detach was the issue but I tried a code only with one attach in the setup fct and the issue was still here.
Would you have an idea of the issue or a way to debug it ?
Thanks for your help!
#include <IRremote.h>
#include <Servo.h>
int IR_PIN = 11;
int SERVO_PIN = 10;
int cpt_time = 0;
Servo myservo;
int SERVO_STOP = 72;
IRrecv irrecv(IR_PIN);
decode_results results;
void setup()
{
 irrecv.enableIRIn(); // Start the receiver
 Serial.begin(9600);
}
void loop() {
 if (irrecv.decode(&results)) {       //received something on IR
  myservo.attach(SERVO_PIN);     //prepare the motor
  myservo.write(SERVO_STOP);    //don't move
  if (results.value==16712445) {     //goes backward - |<<
   Serial.println("-- Starting backward");
   myservo.write(110);           Â
   delay(25000);                  //go back to 9pm
   Serial.println("-- Finished Backward");
  }
  if (results.value==16761405) { //goes forward - >>|
   Serial.println("++ Started Forward");
   myservo.write(1);
   delay(22000);               //go to 10am
   Serial.println("++ Finished forward");
  }Â
  if (results.value==16748655) { //correct time - forward
   myservo.write(68);
   delay(600);Â
  }
  myservo.detach();
  irrecv.resume(); // Receive the next value
  cpt_time=0;
  Serial.println("Resumed listening");
 }
 //simulate a standard clock. Uses if to avoid a long delay to allow remote to work
 if(cpt_time==800){
  myservo.attach(SERVO_PIN); Â
  myservo.write(SERVO_STOP);
  myservo.write(69);
  delay(80);Â
  myservo.detach();
  cpt_time=0;
  Serial.println("Tic Tac");
 }
 else{
  delay(50);
  cpt_time++;
 }
Â
}