Seeeduino Stalker RTC Code ("hello, world")

| | Comments (0) | TrackBacks (0)


Here's some simple code for the Seeeduino Stalker that can optionally reset the RTC and then prints the current time. It's not well-speced but the Stalker uses the standard DS-1307 real-time clock (RTC) so all the routines that use that library should just work plug-n-play:

 








#include <Wire.h>

#include "Time.h"
#include "DS1307RTC.h"

void setup() {
Serial.begin(9600);

// the next two lines can be removed if the RTC has been set
// setTime(6,51,0,6,8,10);
// set time to 17:05:00 1 Mar 2010 (see below)
// RTC.set(now()); // set the RTC to the current time (set in the previous line)

// format for setting time - setTime(hr,min,sec,day,month,yr);

setSyncProvider(RTC.get); // the function to get the time from the RTC

}

void loop() {
Serial.print( "The time is ");
 
Serial.print( year() );
Serial.write('/');
 
Serial.print( month() );
Serial.write('/');

Serial.print( day() );
Serial.write(' ');
 
Serial.print( hour() );
Serial.write(':');

Serial.print( minute() );
Serial.write(':');

Serial.println( second() );

}

0 TrackBacks

Listed below are links to blogs that reference this entry: Seeeduino Stalker RTC Code ("hello, world").

TrackBack URL for this entry: http://www.photoethnography.com/cgi-bin/mt/mt-tb.cgi/879

Leave a comment

About this Entry

This page contains a single entry by Karen Nakamura published on August 15, 2010 9:43 PM.

Seeeduino (Arduino clone) connector was the previous entry in this blog.

Reader's Mailbag: Motor questions is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.