-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRTCsetup.ino
45 lines (34 loc) · 1.37 KB
/
RTCsetup.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// this code will setup SD Shield RTC!
// upload it before you'll upload the main geiger.ino
//#include <LiquidCrystal.h>
#include <Wire.h>
#include <DS1307.h>
#include <EEPROM.h>
#define UNITS_ADDR 0 // int 2 bytes
void setup(){
//-------------------Initilize LCD---------------------//
// LiquidCrystal lcd(9, 4, 8, 7, 6, 5);
//----------------------------------------------------//
int units = 0; // set default Sieverts units
EEPROM.write (UNITS_ADDR, units); // save units to eeprom
// start I2C for RTC on A4 A5
Wire.begin();
delay(100);
//--------------------Adjusting RTC time and date----------------------------------------//
// NEED TO UPLOAD THIS CODE JUST ONCE!
// Be sure 3V battery is connected.
// Edit values and then upload the scetch.
// Do not remove the battery! Otherwise you'll need to adjust again.
//--------------------------------------------------------------------------------------//
RTC.stop();
RTC.set(DS1307_SEC,0); //set the seconds
RTC.set(DS1307_MIN,15); //set the minutes
RTC.set(DS1307_HR,4); //set the hours
RTC.set(DS1307_DOW,4); //set the day of the week
RTC.set(DS1307_DATE,19); //set the date
RTC.set(DS1307_MTH,06); //set the month
RTC.set(DS1307_YR,15); //set the year
RTC.start();
}
void loop(){
}