#include <Wire.h>
#include <RTClib.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
RTC_DS1307 rtc;
void setup () {
Serial.begin(57600);
#ifndef ESP8266
while (!Serial); // wait for serial port to connect. Needed for native USB
#endif
if (! rtc.begin()) {
Serial.println("Couldn't find RTC");
Serial.flush();
abort();
}
if (! rtc.isrunning()) {
Serial.println("RTC is NOT running, let's set the time!");
// When time needs to be set on a new device, or after a power loss, the
// following line sets the RTC to the date & time this sketch was compiled
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
}
// When time needs to be re-set on a previously configured device, the
// following line sets the RTC to the date & time this sketch was compiled
// rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
}
void loop() {
DateTime now = rtc.now();
//buffer can be defined using following combinations:
//hh - the hour with a leading zero (00 to 23)
//mm - the minute with a leading zero (00 to 59)
//ss - the whole second with a leading zero where applicable (00 to 59)
//YYYY - the year as four digit number
//YY - the year as two digit number (00-99)
//MM - the month as number with a leading zero (01-12)
//MMM - the abbreviated English month name ('Jan' to 'Dec')
//DD - the day as number with a leading zero (01 to 31)
//DDD - the abbreviated English day name ('Mon' to 'Sun')
char buf1[] = "hh:mm";
Serial.println(now.toString(buf1));
char buf2[] = "YYMMDD-hh:mm:ss";
Serial.println(now.toString(buf2));
char buf3[] = "Today is DDD, MMM DD YYYY";
Serial.println(now.toString(buf3));
char buf4[] = "MM-DD-YYYY";
Serial.println(now.toString(buf4));
delay(1000);
}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
ds1307:GND
ds1307:5V
ds1307:SDA
ds1307:SCL
ds1307:SQW
btn1:1.l
btn1:2.l
btn1:1.r
btn1:2.r
btn2:1.l
btn2:2.l
btn2:1.r
btn2:2.r
lcd1:GND
lcd1:VCC
lcd1:SDA
lcd1:SCL
bz1:1
bz1:2