Hello all,
I am pretty new to the forum and have tinkered with a few of the Arduino projects in the past few years, although I am still very much a novice so any help would be much appreciated. The project I am making is a Medication reminder. using an UNO, LCD2004a, DS1307, and a few LED lights. I have successfully programmed so far to dislplay the correct date and time but am having a hard time turning on the LED at specific days. I would like for one LED (Green) to be turned on Monday @ 09:00PM and stay on until Friday morning @ 03:00 am, at that point the Green would turn off and a yellow LED would turn on until Friday @ 12:00pm, when it would turn off and the Green would again turn on until Monday @ 03:00 Ive included the code im working with so far
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 16 chars and 2 line display
#include "Arduino.h"
#include "uRTCLib.h"
// uRTCLib rtc;
uRTCLib rtc(0x68);
char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
void setup()
{delay (2000);
Serial.begin(9600);
Serial.println("Serial OK");
#ifdef ARDUINO_ARCH_ESP8266
URTCLIB_WIRE.begin(0, 2); // D3 and D4 on ESP8266
#else
URTCLIB_WIRE.begin();
#endif
rtc.set(0, 29, 11, 7, 13, 7, 24);
// rtc.set(second, minute, hour, dayOfWeek, dayOfMonth, month, year)
// set day of week (1=Sunday, 7=Saturday)
}
void loop()
{
rtc.refresh();
digitalWrite(13, LOW);
lcd.init();
lcd.backlight();
lcd.setCursor(2,0);
lcd.print(rtc.month() );
lcd.print("/");
lcd.print(rtc.day() );
lcd.print("/");
lcd.print(rtc.year() );
lcd.print(" ");
lcd.print(rtc.hour() );
lcd.print(":");
lcd.print(rtc.minute() );
lcd.print(":");
lcd.print(rtc.second() );
lcd.setCursor(6,1);
lcd.print(daysOfTheWeek[rtc.dayOfWeek()-1]);
lcd.setCursor(0,2);
lcd.print("Temperature:");
lcd.setCursor(0,3);
lcd.print("Humidity:");