User Tools

Site Tools


arduino:ds1302

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
arduino:ds1302 [2017/07/21 11:29] – aistisarduino:ds1302 [2017/07/23 09:58] (current) – aistis
Line 1: Line 1:
 +Laikrodis
 +
 http://playground.arduino.cc/Main/DS1302 http://playground.arduino.cc/Main/DS1302
  
Line 4: Line 6:
  
  
-load files from here:+arduino biblioteka yra cia:
  
 http://domoticx.com/arduino-library-ds13xx-en-ds32xx-rtc-module/ http://domoticx.com/arduino-library-ds13xx-en-ds32xx-rtc-module/
 +
 +pvz rasi cia:
 +
 +http://domoticx.com/arduino-rtc-tijdklok-ds1302/
 +
 +ir veikia:
 +
 +{{:arduino:pasted:20170723-095744.png}}
 +
 +kodas:
 +
 +<code c>
 +// DS1302_Serial_Easy (C)2010 Henning Karlsen
 +// web: http://www.henningkarlsen.com/electronics
 +//
 +// A quick demo of how to use my DS1302-library to 
 +// quickly send time and date information over a serial link
 +//
 +// I assume you know how to connect the DS1302.
 +// DS1302:  CE pin    -> Arduino Digital 2
 +//          I/O pin   -> Arduino Digital 3
 +//          SCLK pin  -> Arduino Digital 4
 +
 +#include <DS1302.h>
 +
 +// Init the DS1302
 +DS1302 rtc(8, 7, 6);
 +
 +void setup()
 +{
 +  // Set the clock to run-mode, and disable the write protection
 +  rtc.halt(false);
 +  rtc.writeProtect(false);
 +  
 +  // Setup Serial connection
 +  Serial.begin(9600);
 +
 +//  rtc.setDOW(SUNDAY);        // Set Day-of-Week to FRIDAY
 +//  rtc.setTime(9, 56, 20);     // Set the time to 12:00:00 (24hr format)
 +//  rtc.setDate(23, 7, 2017);   // Set the date to August 6th, 2010
 +}
 +
 +void loop()
 +{
 +  // Send Day-of-Week
 +  Serial.print(rtc.getDOWStr());
 +  Serial.print(" ");
 +  
 +  // Send date
 +  Serial.print(rtc.getDateStr());
 +  Serial.print(" -- ");
 +
 +  // Send time
 +  Serial.println(rtc.getTimeStr());
 +  
 +  // Wait one second before repeating :)
 +  delay (1000);
 +}
 +</code>
 +
 +
arduino/ds1302.1500625787.txt.gz · Last modified: by aistis