#include <RTClib.h> // RTC Library
#include <Wire.h> // I2C Library
#define HOUR 19 // Wake-Up Time (hour)
#define MINUTE 42 // Wake-Up Time (minutes) // i.e. Wake up at 5:40 (24hr clock)
#define SECONDS
#include <Servo.h>
int pos=0 ;
int ServoPin=5; // the pin where the servo is connected
int position_target= 0;
int position_last_set= 0;
int rs=7;
int en=8;
int d4=9;
int d5=10;
int d6=11;
int d7=12;
bool wake_up_now = false;
Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most board
RTC_DS3231 rtc;
LiquidCrystal lcd(rs,en,d4,d5,d6,d7);
void setup() {
// put your lcdsetup code here, to run once:
Serial.begin(115200); // Start Serial Monitor
myservo.attach(ServoPin); // attaches servo on pin 10 to servo object
Wire.begin();
rtc.begin();
if (!rtc.begin())
{
Serial.println("Couldn't find RTC"); // Error Message!
while (1);
}
rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // Uncomment – Compile – Upload)
}
void loop()
{
static int lastSECOND = 0;
lcd.setCursor(0, 0);
DateTime now = rtc.now();
//has seconds changed ?
if (lastSECOND != now.second())
{
//update to the new second
lastSECOND = now.second();
Serial.print(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.println();
//is it time to operate the servo ?
if ((now.minute() == MINUTE) && (now.hour() == HOUR) && (now.second() == SECONDS))
{
//*****************
for (pos = 0; pos <= 120; pos += 1) //goes from 0 degrees to 120 degrees
{
myservo.write(pos); //tell servo to go to position in variable 'pos'
delay(3); //waits 3ms for the servo to reach the position
}
//*****************
for (pos = 120; pos >= 0; pos -= 1) //goes from 120 degrees to 0 degrees
{
myservo.write(pos); //tell servo to go to position in variable 'pos'
delay(3); //waits 3ms for the servo to reach the position
}
//*****************
for (pos = 0; pos <= 120; pos += 1) //goes from 0 degrees to 120 degrees
{
myservo.write(pos); //tell servo to go to position in variable 'pos'
delay(3); //waits 3ms for the servo to reach the position
}
//*****************
for (pos = 120; pos >= 0; pos -= 1) //goes from 120 degrees to 0 degrees
{
myservo.write(pos); //tell servo to go to position in variable 'pos'
delay(3); //waits 3ms for the servo to reach the position
}
myservo.write(0); //moves forward
delay (1000); //waits 1 second
myservo.write(90); //stops
} //END of if ((now.minute() == MINUTE) && (now.hour() == HOUR) && (now.second() == SECOND))
} //END of if (lastSECOND != now.second())
} //END of loop()
This is the error
expected primary-expression before ')' token
//is it time to operate the servo ?
if ((now.minute() == MINUTE) && (now.hour() == HOUR) && (now.second() == SECONDS))
I've been debugging for days and once i fixed a problem this came up by the way this is just a part of the code if any of you could help it would be appreciated