DS1307 test sketch


While debugging the code for a larger Arduino sketch/shield project, I isolated the RTC code in a separate sketch. Finding the problem was not there I thought it might be of interest or amusement for others. It used the DS1307new library, but adapting to other DS1307 libraries should not be difficult.

The sketch uses just the serial port as interface, but an LCD might show the time. It currently allows getting and setting the time and date with simple commands.

D or Dyyyymmdd to get or set the date
T or Thhmmss to get or set the time

Commands are terminated with a carriage-return, a line-feed or a dot. So the Serial Monitor can be used.

Have fun.