[SOLVED]Setting an alarm for servo with RTC

Please Somebody, help me.

im newbie, please tell me how to overcome this set time?

Thanks, Pads.

#include <TimeLib.h>
#include <TimeAlarms.h>
#include <DS1307RTC.h>
#include <Servo.h>

Servo motorServoh;
int pos1 =60;
int pos2 =75;
int pos3 =90;
int pos4 =75;
int pos5 =60;
int durasi1=6300*1000;
int durasi2=6300*1000;
int durasi3=6300*1000;
int durasi4=6300*1000;
int durasi5=5400*1000;

void setup(){
  Serial.begin(9600);
  while (!Serial);
  motorServoh.attach(9);

  setTime(9,59,0,04,12,20);
  Alarm.alarmRepeat(10,0,0, pertama);
  Alarm.alarmRepeat(11,0,0, kedua);
  Alarm.alarmRepeat(12,0,0, ketiga);
  Alarm.alarmRepeat(13,0,0, keempat);
  Alarm.alarmRepeat(14,0,0, kelima);
  Alarm.alarmRepeat(12,0,0, kembali); 
  }

  void pertama(){
   putaran1();
   Serial.println("Putaran1");
   }

  void kedua(){
   putaran2();
   Serial.println("Putaran2");
   }

  void ketiga(){
   putaran3();
   Serial.println("Putaran3");
   }

  void keempat(){
   putaran4();
   Serial.println("Putaran4");
   }

  void kelima(){
   putaran5();
   Serial.println("Putaran5");
   }

   void kembali(){
    motorServoh.write(0);
    Serial.println("kembali");
    }

  void loop() {
   digitalClockDisplay ();
   Alarm.delay (1000);
   }

   void digitalClockDisplay(){
    Serial.print(hour());
    printDigits(minute());
    printDigits(second());
    Serial.println(); 
    }

   void printDigits(int digits){
    Serial.print(":");
    if(digits < 10)
    Serial.print('0');
    Serial.print(digits);
    }

   void putaran1(){
    for(pos1= 60;pos2<=75;pos2+=1){ 
      motorServoh.write(pos1);
      delay(durasi1);
      }}

   void putaran2(){
    for(pos2= 75;pos3<=90;pos3+=1){
      motorServoh.write(pos2);
      delay(durasi2);
      }}

   void putaran3(){
    for(pos3= 90;pos4<=75;pos4+=1){
      motorServoh.write(pos3);
      delay(durasi3);
      }}

   void putaran4(){
    for(pos4= 75;pos5<=60;pos5+=1){
      motorServoh.write(pos4);
      delay(durasi4);
      }}

   void putaran5(){
   for(pos5= 60;pos2<=90;pos5+=1){
      motorServoh.write(pos5);
      delay(durasi5);
   }}
int durasi1=6300*1000;

If you’re on an AVR, that’s not gonna fit…

}} I hate it when that happens.

i mean that int duration is only for delay.
my problem is 'set time function' how do i fix that?

pads:
i mean that duration is only for int delay.
then how do i fix that?

replace int durasi1=6300*1000; with unsigned long durasi1=6300UL*1000;

this number just for delay,

My problem is:

void setup(){
  Serial.begin(9600);
  while (!Serial);
  motorServoh.attach(9);

  [color=red] setTime(9,59,0,04,12,20); [/color]
  Alarm.alarmRepeat(10,0,0, pertama);
  Alarm.alarmRepeat(11,0,0, kedua);
  Alarm.alarmRepeat(12,0,0, ketiga);
  Alarm.alarmRepeat(13,0,0, keempat);
  Alarm.alarmRepeat(14,0,0, kelima);
  Alarm.alarmRepeat(12,0,0, kembali);
  }

Your problem is what?

Colour tags don’t work inside code tags?

my problem is ‘setTime’ Cannot be used as a function. exit status 1

The code in the image you posted is not the same as the code you posted. Please post the most up to date sketch.

oh im so sorry, i just change Initialize and a litle bit try new a library.
my code still the same.
this is my code and my problem:

Capture.JPG

pads:
oh im so sorry, i just change Initialize and a litle bit try new a library.

Just to be 100% safe, please repost your most recent sketch, in code tags. The exact same one that is giving you the error message. You can also cut and paste error message text, there is no need to use images.

Do you have any example sketch that came with your libraries, that uses setTime()? Look there to see how it's done.

so sorry, i still experience the same problem that is setTime. and now "nomatching function for call to ‘DS1307RTC::DS1307RTC(const unit8_t&, const unit8_t&)’

sourcecode update:

#include <DS1307RTC.h>
#include "TimeLib.h"
#include <TimeAlarms.h>
#include <Wire.h>
#include <Servo.h>

//Assign Motor Servo
Servo BT; //BT (Barat-Timur)

DS1307RTC myRTC(SDA, SCL);

int pos1 =60;
int pos2 =75;
int pos3 =90;
int pos4 =75;
int pos5 =60;
int durasi1=6300*1000;
int durasi2=6300*1000;
int durasi3=6300*1000;
int durasi4=6300*1000;
int durasi5=5400*1000;

void setup(){
  Serial.begin(9600);
  while (!Serial);
  BT.attach(9);

  myRTC.setDS1307Time(9,59,0,04,12,20);
  Alarm.alarmRepeat(10,0,0, pertama);
  Alarm.alarmRepeat(11,0,0, kedua);
  Alarm.alarmRepeat(12,0,0, ketiga);
  Alarm.alarmRepeat(13,0,0, keempat);
  Alarm.alarmRepeat(14,0,0, kelima);
  Alarm.alarmRepeat(9,58,0, kembali); 
  }

  void pertama(){
   putaran1();
   Serial.println("Putaran1");
   }

  void kedua(){
   putaran2();
   Serial.println("Putaran2");
   }

  void ketiga(){
   putaran3();
   Serial.println("Putaran3");
   }

  void keempat(){
   putaran4();
   Serial.println("Putaran4");
   }

  void kelima(){
   putaran5();
   Serial.println("Putaran5");
   }

   void kembali(){
    motorServoh.write(0);
    Serial.println("kembali");
    }

  void loop() {
   digitalClockDisplay ();
   Alarm.delay (1000);
   }

   void digitalClockDisplay(){
    Serial.print(hour());
    printDigits(minute());
    printDigits(second());
    Serial.println(); 
    }

   void printDigits(int digits){
    Serial.print(":");
    if(digits < 10)
    Serial.print('0');
    Serial.print(digits);
    }

   void putaran1(){
    for(pos1= 60;pos2<=75;pos2+=1){ 
      motorServoh.write(pos1);
      delay(durasi1);
      }}

   void putaran2(){
    for(pos2= 75;pos3<=90;pos3+=1){
      motorServoh.write(pos2);
      delay(durasi2);
      }}

   void putaran3(){
    for(pos3= 90;pos4<=75;pos4+=1){
      motorServoh.write(pos3);
      delay(durasi3);
      }}

   void putaran4(){
    for(pos4= 75;pos5<=60;pos5+=1){
      motorServoh.write(pos4);
      delay(durasi4);
      }}

   void putaran5(){
   for(pos5= 60;pos2<=90;pos5+=1){
      motorServoh.write(pos5);
      delay(durasi5);
   }}

im newbie, please somebody help me.

The error message is telling you that the constructor you are using doesn’t appear to march any in the library.

int durasi1=6300*1000; That’s still not going to fit.

and this?

#include <Servo.h>
#include <Wire.h>
#include <DS1307RTC.h>
#include "TimeLib.h"
#include <TimeAlarms.h>

//Assign Motor Servo
Servo BT; //BT (Barat-Timur)

DS1307RTC myRTC(SDA, SCL);

int pos1 =60;
int pos2 =75;
int pos3 =90;
int pos4 =75;
int pos5 =60;

void setup(){
  Serial.begin(9600);
  while (!Serial);
  BT.attach(9);

  myRTC.setDS1307Time(9,59,0,04,12,20);
  Alarm.alarmRepeat(10,0,0, pertama);
  Alarm.alarmRepeat(11,0,0, kedua);
  Alarm.alarmRepeat(12,0,0, ketiga);
  Alarm.alarmRepeat(13,0,0, keempat);
  Alarm.alarmRepeat(14,0,0, kelima);
  Alarm.alarmRepeat(9,58,0, kembali); 
  }

  void pertama(){
   putaran1();
   Serial.println("Putaran1");
   }

  void kedua(){
   putaran2();
   Serial.println("Putaran2");
   }

  void ketiga(){
   putaran3();
   Serial.println("Putaran3");
   }

  void keempat(){
   putaran4();
   Serial.println("Putaran4");
   }

  void kelima(){
   putaran5();
   Serial.println("Putaran5");
   }

   void kembali(){
    motorServoh.write(0);
    Serial.println("kembali");
    }

  void loop() {
   digitalClockDisplay ();
   Alarm.delay (1000);
   }

   void digitalClockDisplay(){
    Serial.print(hour());
    printDigits(minute());
    printDigits(second());
    Serial.println(); 
    }

   void printDigits(int digits){
    Serial.print(":");
    if(digits < 10)
    Serial.print('0');
    Serial.print(digits);
    }

   void putaran1(){
    for(pos1= 60;pos2<=75;pos2+=1){ 
      motorServoh.write(pos1);
      delay(10000);
      }}

   void putaran2(){
    for(pos2= 75;pos3<=90;pos3+=1){
      motorServoh.write(pos2);
      delay(10000);
      }}

   void putaran3(){
    for(pos3= 90;pos4<=75;pos4+=1){
      motorServoh.write(pos3);
      delay(10000);
      }}

   void putaran4(){
    for(pos4= 75;pos5<=60;pos5+=1){
      motorServoh.write(pos4);
      delay(10000);
      }}

   void putaran5(){
   for(pos5= 60;pos2<=90;pos5+=1){
      motorServoh.write(pos5);
      delay(10000);
   }}

“and this?” What?

I eliminate int durasi for delay

And . . ?