RTC Issue
years ago bought arduino stuffs , got sidetracked other hobbies , shelved before learning anything. i've found little project , have dusted off ol' starter kit. project one: http://www.instructables.com/id/arduino-timer-with-onoff-set-point/
downloaded arduino software , connected per first diagram , loaded set_time_rtc.ino fine , worked, time wrong. googled bunch , found thread on forum person found success "softrtc" file, missing library in instructables link, that's sorted , can load softrtc sketch , correct date shown via serial monitor. sweet!
second step time displayed on lcd , seems in clock_with_rtc_lcd.ino file redundantly trying set rtc, because causes correct time go wrong time. can point me in direction that's happening? 2 lines below "//--------show actual time on lcd--------//"?
here's clock_with_rtc_lcd.ino code link:
downloaded arduino software , connected per first diagram , loaded set_time_rtc.ino fine , worked, time wrong. googled bunch , found thread on forum person found success "softrtc" file, missing library in instructables link, that's sorted , can load softrtc sketch , correct date shown via serial monitor. sweet!
second step time displayed on lcd , seems in clock_with_rtc_lcd.ino file redundantly trying set rtc, because causes correct time go wrong time. can point me in direction that's happening? 2 lines below "//--------show actual time on lcd--------//"?
here's clock_with_rtc_lcd.ino code link:
code: [select]
//njarpa
//simple clock rtc 1307
#include <liquidcrystal.h> //libraries
#include <rtclib.h>
#include <wire.h>
liquidcrystal lcd(2, 3, 4, 5, 6, 7); //pines arduino lcd
//lcd 1602
//2pin rs, 3pin en, d4 4pin, d5 5pin, d6 6pin, d7 7pin
//contrast= 10k potentiometer 1 vcc, 2(center)to vo, 3 gnd
//backlight= k gnd(with 1k resistor), vcc
//vss gnd , vdd +5v
rtc_ds1307 rtc; // define real time clock object
//rtc 1307
//sda analog 4, scl analog 5
void setup(){
wire.begin();
rtc.begin();
lcd.begin(16, 2); // configura lcd numero columnas y filas
lcd.setcursor(0,0); //show "time" on lcd
lcd.print("time");
}
void loop(){
//--------show actual time on lcd--------//
datetime = rtc.now(); // clock call
now = rtc.now();
lcd.setcursor(5,0);
if(now.hour() < 10)
{
lcd.print("0");
}
lcd.print(now.hour(), dec); //print hour
lcd.print(':');
if(now.minute() < 10)
{
lcd.print("0");
}
lcd.print(now.minute(), dec); //print min
lcd.print(':');
if(now.second() < 10)
{
lcd.print("0");
}
lcd.print(now.second(), dec); //print sec
}
quote
it seems in clock_with_rtc_lcd.ino file redundantly trying set rtcnothing in code setting rtc. "the wrong time" meaningless without knowing time showing, , time is.
Arduino Forum > Using Arduino > Programming Questions > RTC Issue
arduino
Comments
Post a Comment