hey there
im still learning and want to ask -
how i can set action that will be triggered, when exact time occur? before i used iarduino_RTC library, but got some strange device behavior, so decided to change to more modern lib.
#include <Wire.h>
#include <Servo.h>
#include "RTClib.h"
RTC_DS1307 rtc;
const int buttonPin = 3;
int buttonState = 0;
int PowerPin = 4;
int angle = 112;
Servo myservo; // create servo object to control a servo
const int servoPWcontrol = 5; // the number of serwo porwe control
void setup ()
{
Serial.begin(9600);
pinMode(PowerPin, OUTPUT);
digitalWrite(PowerPin, HIGH);
pinMode(buttonPin, INPUT);
if (! rtc.begin())
{
Serial.println("Couldn't find RTC");
while (1);
}
if (! rtc.isrunning())
{
Serial.println("RTC is NOT running!");
}
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));//auto update from computer time
//rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));// to set the time manualy
myservo.attach(9);
myservo.write(angle);
pinMode(servoPWcontrol, OUTPUT);
digitalWrite(servoPWcontrol, LOW); // Turn powersource od servo OFF
Serial.println("Type Command by first letter (gettime - G)");
}
void loop ()
{
delay(900);
DateTime now = rtc.now();
buttonState = digitalRead(buttonPin);
if
here im trying to set if
my time 10:00:00, then next action will be triggered, but im not sure what to do in that lib. i tried to read library documentation, but found no answer. here is what supposed to execute after:
//if(now.hour())
{
digitalWrite(servoPWcontrol, HIGH);
delay(1000);
myservo.write(70);
delay(1500);
myservo.write(112);
delay(1000);
digitalWrite(servoPWcontrol, LOW);
Serial.println("Servo moved. They need more...");
delay(60000);
}
ty!