steinie44:
I don't really have the time to learn coding, barley enough to manipulate what I can find,
We are here to help, not do it for you. Might be better to pop open a beer and do some learning.
And what if I just cant do it? Not everyone can rebuild an automatic transmission. They may, if they are lucky, able to change the oil and maybe adjust a band it thats an option, but, to pull all the bolts out to remove it, pull the front pump ass and replace the clutch plates and seals? Maybe you expect said person to be able to construct a nuclear bomb also? Some cant do it, I dont care HOW many beers they drink. I am sure everyone can push a bomb out of a plane after they already get it, get my point? I even asked for some links and I would try to reverse engineer it. I wasn't just asking for someone to "just" do it ALL for me. I do appreciate the pep talk though. Besides, the more beer I drink, the less I seem to understand.
Code update: Noticed my AM hours were not showing. I had to go through the script to figure out what was wrong. Not sure what it was, but, more cutting and copying seemed to fix it.
//V1 - original release
#include <Wire.h>
#include <DS3231.h>
#include <LiquidCrystal_I2C.h>
#define I2C_ADDR 0x27 // I2C address of PCF8574A
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7
LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin, BACKLIGHT_PIN, POSITIVE);
//////////////Create the DS3231 object///////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
DS3231 RTC;
int seconds;
int minutes;
int hours;
int adjHours;
int dayOfWeek;
int dayOfMonth;
int month;
int year;
int tempC;
int tempF;
void setup(){
Serial.begin(9600);
Wire.begin();
// RTC.begin();
////////////// force time setting //////////////////////////////////////
///////////////////////////////////////////////////////////////////////
/* seconds = 00;
minutes = 52;
hours = 23; //in 24 hour mode
dayOfWeek = 3; //1 is Sunday
dayOfMonth = 19;
month = 8;
year = 14;
initChrono();//just set the time once on your RTC
*/
//////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
lcd.begin(20, 4); // tells Arduino the LCD dimensions
lcd.setCursor(0,0);
lcd.print(" ***WHOOPS***");
lcd.setCursor ( 0, 1 ); // go to the 2nd line
lcd.print(" !!Error Detected!!");
lcd.setCursor ( 0, 2 ); // go to the third line
lcd.print(" > Resetting Unit <");
lcd.setCursor ( 0, 3 ); // go to the fourth line
lcd.print(" Please stand by.");
lcd.noBlink();
delay(2000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(" Chris's Reef Tank");
lcd.setCursor(18,1);
lcd.print("v3");
}
void loop() {
////////////poll the DS3231 for the date and time////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
get_time();
get_date();
tempC = RTC.getTemperature();
tempF = (tempC * 1.8) + 32.0; // Convert Celcius to Fahrenheit
Serial.print("adj hours:");
Serial.print(adjHours);
Serial.println(" ");
Serial.print("mins:");
Serial.print(minutes);
Serial.println(" ");
////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//first line - TIME
//pass RTC values into a new variable - this way one variable stores
// time in 24 hour mode and another that can be converted to 12 hour
// mode time is monitored 'in the background' in 24 hour mode using the RTC,
// but is displayed in an adjusted 12-hr format
////////////convert to 12 hr mode for display////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
lcd.setCursor(0,3);
if (hours < 1)
{
adjHours = 12;
}
if ((hours > 12) && (hours < 24)) {
adjHours = hours - 12;
}
if (adjHours <10) {
lcd.print(" ");
lcd.print(adjHours);
}
else
{
lcd.print(adjHours);
}
{
lcd.print(":");
}
//display minutes
if(minutes < 10)
{
lcd.print("0");
}
lcd.print(minutes);{
/* lcd.print(":");
//display seconds
if(seconds < 10) {
lcd.print("0");*/
}
// lcd.print(seconds);*/
///////////////////Display AM/PM//////////////////////////////////////
/////////////////////////////////////////////////////////////////////
if(hours < 12) {
lcd.print("am");
}
else {
lcd.print("pm");
}
lcd.setCursor(7, 2);
lcd.print(" ");
lcd.print(tempF);
lcd.print("F");
lcd.setCursor(12, 3);
/////////////////////Display month////////////////////////////////
/////////////////////////////////////////////////////////////////
if(month < 10){
lcd.print("0");
}
lcd.print(month);
lcd.print("/");
if(dayOfMonth < 10) {
lcd.print("0");
}
lcd.print(dayOfMonth);
lcd.print("/");
////////////////////display year///////////////////////////////////////
//////////////////////////////////////////////////////////////////////
if(year < 10){
lcd.print("0");
}
lcd.print(year);
delay(200);
}
///////////DS3231 RTC interface////////////////////////////////////
//////////////////////////////////////////////////////////////////
void initChrono()
{
set_time();
set_date();
}
void set_date()
{
Wire.beginTransmission(104);
Wire.write(3);
Wire.write(decToBcd(dayOfWeek));
Wire.write(decToBcd(dayOfMonth));
Wire.write(decToBcd(month));
Wire.write(decToBcd(year));
Wire.endTransmission();
}
void get_date()
{
Wire.beginTransmission(104);
Wire.write(3);//set register to 3 (day)
Wire.endTransmission();
Wire.requestFrom(104, 4); //get 5 bytes(day,date,month,year,control);
dayOfWeek = bcdToDec(Wire.read());
dayOfMonth = bcdToDec(Wire.read());
month = bcdToDec(Wire.read());
year = bcdToDec(Wire.read());
}
void zeroSeconds() {
Wire.beginTransmission(104);
Wire.write(0);
Wire.write(decToBcd(seconds));
Wire.endTransmission();
}
void set_time()
{
Wire.beginTransmission(104);
Wire.write(0);
Wire.write(decToBcd(seconds));
Wire.write(decToBcd(minutes));
Wire.write(decToBcd(hours));
Wire.endTransmission();
}
void get_time()
{
Wire.beginTransmission(104);
Wire.write(0);//set register to 0
Wire.endTransmission();
Wire.requestFrom(104, 3);//get 3 bytes (seconds,minutes,hours);
seconds = bcdToDec(Wire.read() & 0x7f);
minutes = bcdToDec(Wire.read());
hours = bcdToDec(Wire.read() & 0x3f);
}
///////////////////////////////////////////////////////////////////////
byte decToBcd(byte val)
{
return ( (val/10*16) + (val%10) );
}
byte bcdToDec(byte val)
{
return ( (val/16*10) + (val%16) );
}